欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

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

程序员文章站 2022-06-28 20:39:48
大体来说,是环境的问题。 第一个错误,如图: 1. 查了网上说是文件夹权限的问题,依次设置了Everyone权限和IIS_IUSER权限,能勾选的都勾选了,然而并没有什么用,看来不是这个问题导致的。 2. 项目是.net core 2.0,所以想,可能是环境问题,需要安装 AspNetCoreMod ......

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

  第一个错误,如图:

  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版本设置为无托管代码,如下图:

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

 

        >>此时不报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文件中添加节点:

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

 

<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

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

 

 

>>发布成功了。

 微软文档:

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