[英]Cannot Host IIS Express in a Windows Service
我關注了以下SO文章- 如何通過Windows服務啟動過程來運行IIS Express
我已經使用以下代碼在計算機上安裝了Windows服務:
private Process _process;
protected override void OnStart(string[] args)
{
var processStartInfo = new ProcessStartInfo
{
FileName = @"C:\Program Files (x86)\IIS Express\iisexpress.exe",
};
_process = new Process
{
StartInfo = processStartInfo,
EnableRaisingEvents = true
};
_process.Start();
}
protected override void OnStop()
{
_process.Kill();
}
但是,當我嘗試啟動該服務時,長時間嘗試啟動該服務后,它失敗了。 當我檢查事件日志時,出現以下IIS Express錯誤:
The worker process for app pool 'Clr4IntegratedAppPool', PID='8596', failed to initialize the http.sys communication when asked to start processing http requests and therefore will be considered ill by W3SVC and terminated. The data field contains the error number.
The worker process failed to initialize correctly and therefore could not be started. The data is the error.
我認為LocalSystem默認沒有網絡訪問權限。 嘗試使用NetworkService用戶。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.