IIS7 不會通過 Process Start 啟動我的 Exe 文件
我讀過很多文章。但據我所知,我已經做了所有。在本地電腦 VS2010 上一切正常。只有在 IIS7 伺服器上工作時才會出現此問題。
如果我從 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>還是同樣的資訊。任何的想法?
*** 新資訊 - 動詞 *** 使用此功能時
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)我收到這個結果:
動詞=, , , , , , ,
*** 找到解決方案 *** 我在使用http://www.fiddler2.com>和<http://technet.microsoft.com/en-us/sysinternals/bb896653時找到了解決方案 問題是在使用 x86 應用程序時結合
verb=runas標誌的 x64 IIS。現在 application 設置為 anycpu (也許這無關緊要)並且verbProcessStartInfo 沒有設置為任何內容。
編輯:
經過漫長的旅程,我和納森巴爾發現了以下內容。IIS 無法執行 EXE 的可能原因是:
- 缺少 IIS 使用者的權限,例如應用程序池使用者或網路服務(在 IIS6 中)。
- x86 EXE 在 x64 機器上執行的問題。
- 典型的 EXE 失敗問題,例如缺少依賴項。
原答案:
您需要
IIS AppPool\DefaultAppPool在 EXE 所在的目錄上為使用者分配 FullControl 安全權限。這是嘗試執行該程序的使用者(假設您使用的是DefaultAppPool),如果沒有適當的權限,則無法執行所以。當您手動執行 EXE 時,您使用的是 Windows 登錄使用者。這就是您可以手動午餐的原因。IIS 使用應用程序池使用者。
要添加權限,只需執行以下操作:
- 轉到目錄屬性
- 安全選項卡
- 編輯.. -> 添加
IIS AppPool\DefaultAppPool- 檢查它
FullControl截圖:
![]()


