.net core mvc发布后 iis 显示异常错误信息的方法,同时添加的webapi方法启动 HttpPut, HttpDelete谓词

一,iis 显示异常错误信息的方法

在发布的项目文件夹中找到web.config文件,修改:

<aspNetCore processPath="dotnet" arguments=".Web.dll" stdoutLogEnabled="false" stdoutLogFile=".logsstdout" hostingModel="InProcess" />

为:

<aspNetCore processPath="dotnet" arguments=".Web.dll" stdoutLogEnabled="false" stdoutLogFile=".logsstdout" hostingModel="InProcess" >
       <environmentVariables>
        <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
      </environmentVariables>
</aspNetCore>

二,webapi方法启动 HttpPut, HttpDelete谓词

   默认报405 Method Not Allowed 错误

  同样在 web.config 下添加如下代码

   

<modules runAllManagedModulesForAllRequests="true">  
      <remove name="WebDAVModule" />  
</modules>  

  

原文地址:https://www.cnblogs.com/qingjiawen/p/13271791.html