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

  大体来说,是环境的问题。

  第一个错误,如图:

  

    1. 查了网上说是文件夹权限的问题,依次设置了Everyone权限和IIS_IUSER权限,能勾选的都勾选了,然而并没有什么用,看来不是这个问题导致的。

    2. 项目是.net core 2.0,所以想,可能是环境问题,需要安装 AspNetCoreModule托管模块。

        >> DotNetCore.2.0.9-WindowsHosting.exe  

        >>安装完成后,使用命令重启IIS       net stop was /y 

                        net start w3svc

        >>编辑应用程序池,把.net clr版本设置为无托管代码,如下图:

            

        >>此时不报500.19的错误,改报

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

 

  第二个错误,502.5:

    尝试了许多方法。

    1. 在FolderProfile.pubxml文件中添加节点:

<PropertyGroup>
 <PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest> 
</PropertyGroup>

     >>重新发布后还是不行。

    2. Net Core SDK没有安装,或者版本安装错误:

        进入网站物理路径目录根目录,打开dos 输入命令,直接运行web程序:dotnet xxxweb.dll

          dotnet.exe报错,>>计算机中丢失 api-ms-win-crt-runtime-l1-1-0.dll

                                      解决方案:安装Visual C++ Redistributable for Visual Studio 2015 组件

                                                         下载地址:https://www.microsoft.com/en-us/download/details.aspx?id=48145

                           

>>发布成功了。

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

 参考博客:https://www.cnblogs.com/eggTwo/p/9900613.html               

此间不逝,岁岁年年。
原文地址:https://www.cnblogs.com/ZCrystal/p/10894538.html