1

次のSOの記事に従いました-Windowsサービスを介して開始されたプロセスとしてIISExpressを実行する方法

次のコードを使用して、マシンに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();
}

しかし、サービスを開始しようとすると、サービスを開始しようと長い間試みた後、失敗します。イベントログを確認すると、次のIISExpressエラーが発生します。

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 に答える