1
我已經按照下面的文章SO - How to run IIS Express as a process started via a Windows Service不能承載IIS Express在Windows服務
我用下面的代碼安裝在我的機器上的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.
IIS已經作爲服務運行。爲什麼你嘗試使用IIS Express而不是IIS? –
@Rhhound - 盡我所能使用IIS而不是IIS Express,我無法做到。 – 5StringRyan
你使用的是什麼味道的窗戶?服務配置運行的用戶是什麼? – user957902