2011-12-07 53 views
10

我读过很多文章。但据我所知,我所做的一切。 在本地计算机上VS2010一切正常。只有在IIS7服务器上工作时才会出现此问题。IIS7无法通过进程启动我的Exe文件

如果我从Windows资源管理器手动启动它,我想启动一个在服务器上很好的exe文件。

Dim fiExe As New IO.FileInfo(IO.Path.Combine(diBase.FullName, "ClientBin\ConvertAudio.exe")) 
    Dim SI As New ProcessStartInfo(fiExe.FullName, args) 
    SI.Verb = "runas" 
    SI.UseShellExecute = True 
    SI.WorkingDirectory = fiExe.Directory.FullName 
    Dim P As Process = Process.Start(SI) 
    P.PriorityClass = ProcessPriorityClass.Idle 

我已经转换目录ClientBin在IIS中的应用。

但使用该服务时,我收到此错误(在Silverlight应用回调):

{System.Security.SecurityException ---> System.Security.SecurityException: Sicherheitsfehler 
    bei System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult) 
    bei System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClass5.<EndGetResponse>b__4(Object sendState) 
    bei System.Net.Browser.AsyncHelper.<>c__DisplayClass4.<BeginOnUI>b__0(Object sendState) 
    --- Ende der internen Ausnahmestapelüberwachung --- 
    bei System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state) 
    bei System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult) 
    bei System.Net.WebClient.WebClientWriteStream.<Dispose>b__3(IAsyncResult ar)} 

我试图存储文件“clientaccesspolicy.xml” 在同一个目录像ClientBin

<?xml version="1.0" encoding="utf-8"?> 
<access-policy> 
    <cross-domain-access> 
     <policy> 
      <allow-from http-request-headers="*"> 
       <domain uri="*"/> 
      </allow-from> 
      <grant-to> 
       <resource path="/" include-subpaths="true"/> 
      </grant-to> 
     </policy> 
    </cross-domain-access> 
</access-policy> 

仍然是一样的信息。 有什么想法?

ISS7 Commandline configuration

permission in Windows Explorer

*新的信息 - 动词* 使用此功能时

Dim startInfo As New ProcessStartInfo(fiExe.FullName) 
      Dim V As String = "" 
      For Each verb As String In startInfo.Verbs 
       V &= V & ", " 
      Next 
      Throw New Exception("Verbs=" & V) 

我得到这个结果:

动词=,,, ,,,,,

*发现的解决方案* 我已经找到了解决方案,同时使用,同时使用的x86应用程序在x64组合IIS与verb=runas标志http://www.fiddler2.comhttp://technet.microsoft.com/en-us/sysinternals/bb896653 问题。现在应用程序被设置为anycpu(也许这没有关系)并且ProcessStartInfo上的verb未设置为任何值。

回答

13

编辑:

经过长途跋涉,我和Nasenbaer发现以下。 IIS的可能原因为失效运行EXE是:

  1. 为IIS用户,诸如应用程序池用户,或者网络服务(在IIS6)的权限的缺失。
  2. 在x64计算机上运行的x86 EXE问题。
  3. 典型的EXE失败问题,如缺少依赖关系。

原来的答复:

您需要分配FullControl安全权限的IIS AppPool\DefaultAppPool用户,在EXE位于目录这是试图运行过程(用户假设您使用的是DefaultAppPool),并且没有适当的权限,则无法这样做。

当您手动运行EXE时,您正在使用Windows登录用户。这就是为什么你可以手动午餐。 IIS使用应用程序池用户。

要添加权限,只是执行以下操作:

  1. 进入目录的属性
  2. 安全选项卡
  3. 编辑.. - >添加IIS AppPool\DefaultAppPool
  4. 检查它的FullControl

截图

enter image description here enter image description here

+0

谢谢你很多迈克尔。这听起来像它应该工作。我感到很蠢,但我不知道在哪里找到你正在谈论的'FullControl'标志。我添加了一张图片。请你能尝试给我提供一些菜单的细节来找到'FullControl'吗? – Nasenbaer

+0

@Nasenbaer:转到资源管理器中的实际文件夹,而不是在IIS管理器中。让我知道你是否需要截图。 – MichaelS

+0

嗨MichaelS。再次感谢。在我在Stackoverflow中发布之前,我已经检查过这个问题。但是因为我在IIS用户上看到所有内容都是“完全访问”,所以我无法解决问题。请,是的,你能否在Windows资源管理器中提供我的菜单(英文应该没问题)?我添加了一张新照片来显示我查看的位置。 – Nasenbaer

-1
var p = new Process 
{ 
    StartInfo = 
    { 
     FileName = Path,  
     UseShellExecute = false, 
    } 
}; 
p.Start(); 
+0

我已经完成了描述。对不起,但这不起作用。 – Nasenbaer

6

什么帮助我是这样的:在应用程序池 身份 设置=本地系统

  1. 打开应用程序池
  2. 找到您的池(由默认DefaultAppPool)
  3. 点击“高级设置”
  4. 改变身份为“本地系统”

希望这将帮助别人......

+0

它应该工作,但它不是安全的方法。 –

+0

这是我的解决方案。谢谢! –

相关问题