20

I am trying to view the errors for my website, when I go to the site i get this message:

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 remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine. 

Details: To enable the details of this specific error message to be viewable on remote machines, 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 "Off".


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

<configuration>
    <system.web>
        <customErrors mode="Off"/>
    </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="RemoteOnly" defaultRedirect="mycustompage.htm"/>
    </system.web>
</configuration>

So what I've done is create a web.config file with this in it:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.web>
     <customErrors mode="Off"/>
  </system.web>
</configuration>

But sadly for me that really made jack all difference. What am I doing wrong here guys?

Hithere Paperbag
  • 2,648
  • 4
  • 19
  • 20

3 Answers3

11

Try this: CustomErrors mode="Off"

By the way, asp net project templates include web.config file (it should be in the root folder of your project), so you don't have to create it manually. May be you have created another one?

Community
  • 1
  • 1
vsevolod
  • 155
  • 2
  • 10
11

If you are seeing errors locally, but not remotely, then try adding this to the web.config;

<system.webServer>
    <httpErrors errorMode="Detailed" />
</system.webServer>

This is a feature of IIS to hide potentially compromising internal workings of your website to outside users, so there is a reason why it's not det as default.

Fiach Reid
  • 6,149
  • 2
  • 30
  • 34
-2

It may not be IIS!

I tried both solutions on this page, as well as several more. None of them solved our issue, BUT they are good things to check and WILL cause problems. So I'd check those first.

If you're still pulling your hair out, and you're using PHP, with or without ASP.net (we were using both) with the same web.config setup as the OP described, check your PHP settings.

What fixed it for me was to edit our php.ini file and specify:

display_errors: On

I also set:

display_startup_errors: On

just for good measure.

That fixed the problem, and our real issue turned out to be an overlooked comma that was missed during dev to stage migration.

NOTE: The OP's question didn't specify asp.net, but a "tag" did. So, I answered this in good faith for a good fix to the problem the OP described, identical to ours. People searching on the subject line will get this page, even if not using ASP.net. So hopefully this will help someone, as it was our fix.

J. Gwinner
  • 931
  • 10
  • 15
  • 1
    This has nothing to do with ASP... PHP != ASP – John C Jun 01 '21 at 07:35
  • Who said anything about ASP? The question was about web.config, which is used even if ASP is not. In fact, this was FastCGI. Note the tags added asp, but the question was not asp-specific. Bad tags happen all the time. – J. Gwinner Jun 25 '21 at 19:10
  • 1
    Ummmm.... the OP did... Assuming is the worst thing you could ever do. Answers can only be correctly given when correct content is shared with the question. – John C Jun 26 '21 at 06:06
  • The OP added a tag that said asp.net, yes, but his question did not specifically mention ASP. In fact, it's trivial to duplicate his exact configuration and his exact error message with just PHP and no asp.net code at all. – J. Gwinner Jun 30 '21 at 05:07
  • Further, I did mention " If ... you're using PHP," ... – J. Gwinner Jun 30 '21 at 05:10
  • I'm getting so tired of the continual down-votes. If you search for the error string, you get this answer, without the 'dot net' - which was only a tag, not in the OP's error description. Their error description and my error were identical. So I give a correct answer and I've gotten dozens of downvotes. This is absurd. – J. Gwinner Jun 26 '23 at 02:55