.net core显示错误详细信息,需切换到开发环境


当出现以上错误信息时,如需查看详细错误信息,需要切换到开发环境

在网站根目录下找到web.config文件,新增和修改节点aspNetCore的环境变量environmentVariables。

1、生产环境:Production

2、开发环境:Development

<aspNetCore processPath="dotnet" arguments=".\xx.dll" stdoutLogEnabled="false">
    <environmentVariables>
       <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Production" />
    environmentVariables>
aspNetCore>

改为

<aspNetCore processPath="dotnet" arguments=".\xx.dll" stdoutLogEnabled="false">
    <environmentVariables>
       <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
    environmentVariables>
aspNetCore>