2011-12-07 54 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

這是我的解決方案。謝謝! –

相關問題