IIS无法运行ASP.NET Core站点-HTTP错误502.5 [英] IIS fails to run ASP.NET Core site - HTTP Error 502.5

查看:496
本文介绍了IIS无法运行ASP.NET Core站点-HTTP错误502.5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一台Windows 2012 R2计算机. 我上面有一个现有的ASP.NET Core网站,并且正在运行一个运行正常的已发布ASP.NET Core网站.

We have a Windows 2012 R2 machine. I had an existing ASP.NET Core site on it that had a working published ASP.NET Core site running.

但是,当我在做出更改后的一个月后今天再次发布到该网站时,我再也无法访问该网站并在浏览器中出现以下错误

However when I published to the site again today a month later after I made changes, I can't access the site anymore and get the following error in my browser

HTTP错误502.5-进程失败

HTTP Error 502.5 - Process Failure

有关更多信息,请访问: http://go.microsoft.com/fwlink/?LinkID = 808681

For more information visit: http://go.microsoft.com/fwlink/?LinkID=808681

如果我登录到服务器并单击部署目录中的exe,它将打开命令提示符,并在端口5000上显示我的站点.如果我在 http://localhost:5000 效果很好,因此问题出在IIS而不是网站本身.

If I log onto the server and click on the exe in my deployed directory it opens a command prompt and shows my site on port 5000. If I access the site on http://localhost:5000 it works perfectly so the problem is to do with IIS and not the site itself.

如果我登录到服务器,则可以在Windows EventViewer中看到以下内容

If I log onto the server I can see the following in Windows EventViewer

具有物理根目录'D:\ Sites \ MySite \'的应用程序'MACHINE/WEBROOT/APPHOST/DEFAULT WEB SITE/MySite'无法以命令行'%LAUNCHER_PATH%"%LAUNCHER_ARGS%'启动进程,ErrorCode ='0x80070002 :0.

Application 'MACHINE/WEBROOT/APPHOST/DEFAULT WEB SITE/MySite' with physical root 'D:\Sites\MySite\' failed to start process with commandline '"%LAUNCHER_PATH%" %LAUNCHER_ARGS%', ErrorCode = '0x80070002 : 0.

当我访问浏览器错误消息中的链接时,它提到重新安装了.net Core Hosting捆绑包.但是,浏览器中的错误消息是相同的.

When I visit the link in the browser error message it mentioned reinstalling the .net Core Hosting bundle which I did. However the error message in the browser is the same.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
    </handlers>
    <aspNetCore requestTimeout="02:00:00" processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" />
  </system.webServer>
</configuration>

当我查看我的应用程序日志文件夹时,每次尝试访问此站点时都会创建一个stdout文件,但每次文件大小均为0KB且内容为空.

When I look at my app log folder a stdout file does get created for every time it tries to access this site but each time it is of size 0KB and empty contents.

为什么IIS突然无法工作,但为什么我直接访问已编译的exe时,该应用程序仍能正常工作?

Why does IIS refuse to work suddenly where it worked previous but the app works if I access the compiled exe directly?

推荐答案

您的问题是一个错误的web.config文件:

Your problem is a bad web.config file:

<aspNetCore requestTimeout="02:00:00" 
     processPath="%LAUNCHER_PATH%" 
     arguments="%LAUNCHER_ARGS%" 
     stdoutLogEnabled="true" 
     stdoutLogFile=".\logs\stdout" 
     forwardWindowsAuthToken="false" />

路径%LAUNCHER_PATH%在您的系统上不存在,甚至无效.应该是这样的:

The path %LAUNCHER_PATH% does not exist on your system, it is not even valid. It should be something like:

<aspNetCore requestTimeout="02:00:00" 
     processPath=".\yourAppName.exe" 
     arguments="somePossibleArgument" 
     stdoutLogEnabled="true" 
     stdoutLogFile=".\logs\stdout" 
     forwardWindowsAuthToken="false" />

请注意,如果从命令行启动应用程序,则将完全忽略web.config文件,这就是为什么您不会收到该错误的原因.

Notice that the web.config file is completely ignored if the app is launched from the command line, that's why you do not receive the error.

这篇关于IIS无法运行ASP.NET Core站点-HTTP错误502.5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆