.net core 网站部署后出现: An error occurred while processing your request.

An error occurred while processing your request.
Development Mode
Swapping to Development environment will display more detailed information 
about the error that occurred.
Development environment should not be enabled in deployed applications, 
as it can result in sensitive information from exceptions being displayed to end users. 
For local debugging, development environment can be enabled by 
setting the ASPNETCORE_ENVIRONMENT environment variable to Development, 
and restarting the application.

其实意思就是发生了异常, 但因为不是开发环境, 不能展示真正的错误信息给你看。

如果要看真正的错误信息, 可以将 Web.config 修改:

<configuration>
  <!--
    Configure your application settings in appsettings.json. Learn more at http://go.microsoft.com/fwlink/?LinkId=786380
  -->
  <system.webServer>
    <handlers>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
    </handlers>
    <aspNetCore processPath=".\Application.exe" arguments="" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false">
      <environmentVariables>
        <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Production" />
      </environmentVariables>
    </aspNetCore>
  </system.webServer>
</configuration>

value = "Production"

修改为:

value = "Development"

重启服务(其实刷新一下页面就可以了), 再就可以看到真实的异常信息了。

不过, 真正的上线网站, 还是用日志记录异常比较好。

参考: 点击打开链接

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值