Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/303.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 无法在Windows服务中承载IIS Express_C#_Windows Services_Iis Express - Fatal编程技术网

C# 无法在Windows服务中承载IIS Express

C# 无法在Windows服务中承载IIS Express,c#,windows-services,iis-express,C#,Windows Services,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", };

我关注了以下文章-

我已使用以下代码在我的计算机上安装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用户

IIS已作为服务运行。你为什么要用IIS Express而不是IIS?@Ramhound-虽然我很想用IIS而不是IIS Express,但我不能。你用的是什么风格的windows?服务配置为以哪个用户的身份运行?@user957902-服务以本地系统的身份运行。我目前正在使用Windows7Pro进行测试,但它最终将在WindowsXP上运行。我认为LocalSystem默认情况下没有网络访问权限。请尝试使用NetworkService用户。此外,http是一种受保护的资源。查找netsh.exe http add urlacl上的文档