如何设置“web.config"文件以显示完整的错误消息(.NET Core 2.1) [英] How to set the 'web.config' file to show the full error message (.NET Core 2.1)

查看:36
本文介绍了如何设置“web.config"文件以显示完整的错误消息(.NET Core 2.1)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在

我可以使用文件 web.config 以某种方式获取有关错误的其他信息吗?

解决方案

web.config

<httpErrors errorMode="详细信息";/><aspNetCore processPath="dotnet"><环境变量><environmentVariable name="ASPNETCORE_DETAILEDERRORS";值=真"/></环境变量></aspNetCore></system.webServer>

I hosted my ASP.NET Core app on IIS (using the publish-in- folder method). I tried to create my own web.config file to see detailed error messages on the client side. So I added file web.config:

<configuration>
    <system.web>
        <customErrors mode="Off" />
    </system.web>
    <system.webServer>
        <httpErrors errorMode="Detailed" />
    </system.webServer>
</configuration>

After I restarted IIS, nothing happened. Clients still got the default error:

Can I somehow get additional information about errors using file web.config?

解决方案

web.config

<system.webServer>
    <httpErrors errorMode="Detailed" />
    <aspNetCore processPath="dotnet">
        <environmentVariables>
            <environmentVariable name="ASPNETCORE_DETAILEDERRORS" value="true" />
        </environmentVariables>
    </aspNetCore>
</system.webServer>

这篇关于如何设置“web.config"文件以显示完整的错误消息(.NET Core 2.1)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆