1

我已关注以下 SO 文章 -如何将 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.
4

1 回答 1

0

我认为 LocalSystem 默认情况下没有网络访问权限。尝试使用 NetworkService 用户。

于 2012-05-08T18:57:21.570 回答