Getting Detailed Error Info in IIS 7


Server Error in '/' Application.


Runtime Error


Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed.

Details: To enable the details of this specific error message to be viewable on the local server machine, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "RemoteOnly". To enable the details to be viewable on remote machines, please set "mode" to "Off".




<!-- Web.Config Configuration File -->

<configuration>
    <system.web>
        <customErrors mode="RemoteOnly"/>
    </system.web>
</configuration>

Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.




<!-- Web.Config Configuration File -->

<configuration>
    <system.web>
        <customErrors mode="On" defaultRedirect="mycustompage.htm"/>
    </system.web>
</configuration>


Solution

<configuration>

    <system.webServer>
      <httpErrors errorMode="Detailed" />
      <asp scriptErrorSentToBrowser="true" />

      <aspNetCore processPath=".\LibPrograms.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout">
        <environmentVariables>
          <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
        </environmentVariables>
      </aspNetCore>

    </system.webServer>

    <system.web>
      <customErrors mode="Off" />
      <compilation debug="true" />
    </system.web>

</configuration>

Please note:
For Net Core apps:
1. ASPNETCORE_ENVIRONMENT must set to Development in order to display detailed errors
2. The highlighted rows are enough for displaying detailed errors

HTTP 500 - Internal Server Error


IIS &gt; Sites &gt; Your Site &gt; double click "Failed Request Tracing Rules" :
1.  Edit Settings &gt; Enable
2.  Add &gt;All contents (*) &gt; Status Code: 500

Then check logs at C:\inetpub\logs

Note: if  "Failed Request Tracing Rules" is not available in IIS, please go to Control Panel/Programs and Features/Turn Windows Features on or off/Internet Information Service/World Wide Web Service/Health and Diagnotics/Check Tracing/Close and re-open IIS
http://mvolo.com/troubleshoot-iis7-errors-like-a-pro/




Comments

Popular posts from this blog

Use GnuPG Tools or C# Code for PGP Encryption and Signature

Errors in Net Core Add-Migration

Confusing Concepts about SFTP: SSH2 vs OpenSSH