asp.net core 2.0发布到IIS流程及报错解决方案

 

我这是个新装的服务器,没有安装任何软件。

一、发布流程

1.安装AspNetCoreModule托管模块,同时会自动安装..net core runtime

DotNetCore.2.0.8-WindowsHosting.exe

https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/index?view=aspnetcore-2.0

2.重启电脑,或者使用如下命令重启IIS

net stop was /y
net start w3svc

3.安装IIS

4.将项目发布到IIS

5.编辑应用程序池,把.net clr版本设置为无托管代码

二、遇到问题

1.浏览器运行项目,报错如下:

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

这个错误网上有各种各样的解决方案,但是苦苦尝试了将近一天的时间没有一个适合我的。现在汇总各种解决方案,可能有适合你的:

https://www.cnblogs.com/iiwen/p/9209391.html

https://blog.csdn.net/CuiLanren/article/details/80777488

2.查看windows错误日志信息如下:

Application 'MACHINE/WEBROOT/APPHOST/FORM' with physical root 'C:\fabu\' failed to start process with commandline 'dotnet .\Cloud.Boss.dll', ErrorCode = '0x80004005 : c0000135.

3.使用dotnet.exe命令dotnet d:\fabu\boss.dll运行项目,报错如下:

---------------------------
dotnet.exe - 系统错误
---------------------------
无法启动此程序,因为计算机中丢失 api-ms-win-crt-runtime-l1-1-0.dll。尝试重新安装该程序以解决此问题。
---------------------------
确定
---------------------------

3.1. 解决3的错误的方案是:

安装Visual C++ Redistributable for Visual Studio 2015 组件
api-ms-win-crt-runtime组件为 MFC 的运行时环境的库,是用微软的visual studio C++编译的,底层也会用到微软提供的C++库和runtime库,安装Visual C++ Redistributable for Visual Studio 2015 组件即可解决此问题
下载地址:https://www.microsoft.com/en-us/download/details.aspx?id=48145,

如果安装时报错如下:

更新windows系统,或者参考文章:https://blog.csdn.net/neochan1108/article/details/78084073

 4.浏览器重新输入项目地址,问题解决。

 总结

为什么我以前的服务器没有遇到这个问题呢,

那是因为我以前的服务器都装了sqlserver,他会自动安装Visual C++ Redistributable for Visual Studio 2015 组件。而我这个项目用的是mysql,就没有安装此组件。

其实微软官网文档已经说明了,只是我没有看,如下:

https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/index?view=aspnetcore-2.0

猜你喜欢

转载自www.cnblogs.com/eggTwo/p/9900613.html