.NET Core发布到IIS站点之后容易出现HTTP Error 502.5 - Process Failure错误,具体的错误信息如下:
HTTP Error 502.5 - Process Failure
Common causes of this issue:
-
The application process failed to start
-
The application process started but then stopped
-
The application process started but failed to listen on the configured port
Troubleshooting steps:
-
Check the system event log for error messages
-
Enable logging the application process' stdout messages
-
Attach a debugger to the application process and inspect
然后按照错误提示我们去看事件日志如下:
Application 'MACHINE/WEBROOT/APPHOST/CORE' with physical root 'D:\wwwroot\core\' failed to start process with commandline 'dotnet .\CoreTest2.dll', ErrorCode = '0x80004005 : c0000135.
错误原因排查:
1. 确保已经安装.NET Core Windows Server Hosting,成功安装之后可以在 IIS中的模块要已经存在AspNetCoreModule 中查看到。
2.安装之后要确保重启IIS或者重启服务器。
重启IIS的命令如下:
1.net stop was /y
2.net start w3svc
3.确保在CMD的命令行中执行dotnet 确保不会报错。
4.确保发布程序代码的core版本跟server hosting的 版本是对应,否则是有可能出现这个错误的。
如果以上解决不了问题的,建议看看事件查看器和网站的访问日志。根据详细的错误信息再去百度寻找解决方法。