Search code examples
asp.net-coreweb-configiis-10

How to set the 'web.config' file to show the full error message (.NET Core 2.1)


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:

Enter image description here

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


Solution

  • web.config

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