208

IIS 7.5 , 2008rc2, classic asp, 500 error msg:

The page cannot be displayed because an internal server error has occurred.

I need to know how to configure IIS to get a more detailed error.
I've tried setting to true all of debugging options in the ASP configuration.
But that didn't work. Can anyone help me?

Mr Lister
  • 45,515
  • 15
  • 108
  • 150
egidiocs
  • 2,747
  • 3
  • 21
  • 20
  • I am using different way to log error in text file: http://stackoverflow.com/questions/20475502/internal-server-error-500-w-iis-log/20952619#20952619 Main difference -- error informatin will be stored in text file – Zam Oct 05 '15 at 14:14

15 Answers15

251

I have come to the same problem and fixed the same way as Alex K.

So if "Send Errors To Browser" is not working set also this:

Error Pages -> 500 -> Edit Feature Settings -> "Detailed Errors"

enter image description here

Also note that if the content of the error page sent back is quite short and you're using IE, IE will happily ignore the useful content sent back by the server and show you its own generic error page instead. You can turn this off in IE's options, or use a different browser.

Community
  • 1
  • 1
Vaclav Elias
  • 4,101
  • 2
  • 24
  • 28
  • 10
    If it's still not working, [disable friendly http error messages](http://stackoverflow.com/a/15008842/224976) – Tim Partridge Feb 22 '13 at 18:53
  • 3
    If "Error Pages" is missing from your panel, ensure the feature is enabled: Turn Windows features on or off => WWW Services, Common HTTP Features, [x] HTTP Errors – fiat Feb 07 '14 at 03:53
  • 1
    @fiat To enable "Error Pages", I had to go: `Turn Windows features on or off > Internet Information Services > World Wide Web Services > Common HTTP Features > [✓] HTTP Errors`. – Jess Telford Nov 10 '15 at 23:09
  • Note: _"Error Pages"_ and _".NET Error Pages"_ are different. You specifically want _"Error Pages"_. – Jess Telford Nov 10 '15 at 23:10
  • @JessTelford **`HOW-TO`** for ***NET Error Pages***? – Kiquenet Nov 30 '15 at 14:04
  • @Kiquenet I'm not sure, maybe that's worthy of another question? – Jess Telford Dec 03 '15 at 05:59
98

If you're on a remote server you can configure your web.config file like so:

<configuration>
<system.webServer>
    <httpErrors errorMode="Detailed" />
    <asp scriptErrorSentToBrowser="true"/>
</system.webServer>
<system.web>
    <customErrors mode="Off"/>
    <compilation debug="true"/>
</system.web>

safhac
  • 1,141
  • 8
  • 14
52

Double click "ASP" in the site's Home screen in IIS admin, expand "Debugging Properties", enable "Send errors to browser", and click "Apply".

Under "Error Pages" on the home screen select "500", then "Edit feature settings" and select "Detailed Errors".

Note that the same steps apply for IIS 8.0 (Windows Server 2012).

Martha
  • 3,932
  • 3
  • 33
  • 42
Alex K.
  • 171,639
  • 30
  • 264
  • 288
  • Maybe applies to ***IIS 7.5 , Windows 2008 R2, ASP.NET 4.5.1 (WebForms) with CLASSIC AppPool (NOT integrated)*** – Kiquenet Oct 06 '15 at 19:25
44

After trying Vaclav's and Alex's answer, I still had to disable "Show friendly HTTP error messages" in IE

enter image description here

Community
  • 1
  • 1
Tim Partridge
  • 3,365
  • 1
  • 42
  • 52
26

TLDR:First determine where in the pipeline you're getting the error from (scroll looking for screenshots of something that resembles your error), make changes to get something new, repeat.

First determine what error message you are actually seeing.

If you are seeing the file located here...

%SystemDrive%\inetpub\custerr<LANGUAGE-TAG>\500.htm

...which generally looks like this:

IIS Default 500 error

**...then you know you are seeing the currently configured error page in IIS ** and you do NOT need to change the ASP.net customErrors setting, asp error detail setting, or "show friendly http errors" browser setting.

You may want to look at the above referenced path instead of trusting my screenshot just in case somebody changed it.

"Yes, I see the above described error..."

In this case, you are seeing the setting of <httpErrors> or in IIS Manager it's Error Pages --> Edit Feature Settings. The default for this is errorMode=DetailedLocalOnly at the server node level (as opposed to the site level) which means that while you will see this configured error page while remote, you should be able to log on locally to the server and see the full error which should look something like this:

Detailed HTTP Error

You should have everything that you need at that point to fix the current error.

"But I don't see the detailed error even browsing on the server"

That leaves a couple of possibilities.

  1. The browser you are using on the server is configured to use a proxy in its connection settings so it is not being seen as "local".
  2. You're not actually browsing to the site you think you are browsing to - this commonly happens when there's a load balancer involved. Do a ping check to see if dns gives you an IP on the server or somewhere else.
  3. Your site's httpErrors settings is set for "Custom" only. Change it to "DetailedLocalOnly". However, if you have a configuration error, this may not work since the site level httpErrors is also a configuration item. In that case proceed to #4
  4. The default for httpErrors for all sites is set for "Custom". In this case you need to click on the top level server node in IIS Manager (and not a particular site) and change the httpErrors settings there to DetailedLocalOnly. If this is an internal server and you're not worried about divulging sensitive information, you could also set it to "Detailed" which will allow you to see the error from clients other than the server.
  5. You're missing a module on the server like UrlRewrite (this one bites me a lot, and it often gives the generic message regardless of the httpErrors settings).

"Logging on to the server is not an option for me"

Change your site's httpErrors to "Detailed" so you can see it remotely. But if it doesn't work your error might already be a config error, see #3 immediately above. So you might be stuck with #4 or #5 and you're going to need somebody from your server team.

"I'm not seeing the error page described above. I'm seeing something different"

If you see this...

enter image description here

...and you expect to see something like this...

enter image description here

...then you need to change "Send errors to browser" to true in IIS Manager, under Site --> IIS --> ASP --> Debugging Properties

If you see this...

ie friendly errors 1

or this...

ie friendly errors 2

...you need to disable friendly errors in your browser or use fiddler's webview to look at the actual response vs what your browser chooses to show you.

If you see this...

Custom errors enabled

...then custom errors is working but you don't have a custom error page (of course at this point were talking about .net and not classic asp). You need to change your customErrors tag in your web.config to RemoteOnly to view on the server, or Off to view remotely.

If you see something that is styled like your site, then custom errors is likely On or RemoteOnly and it's displaying the custom page (Views->Shared->Error.cshtml in MVC for example). That said, it is unlikely but possible that somebody changed the pages in IIS for httpErrors so see the first section on that.

b_levitt
  • 7,059
  • 2
  • 41
  • 56
24

In web.config under

<system.webServer>

replace (or add) the line

<httpErrors errorMode="Detailed"></httpErrors>

with

<httpErrors existingResponse="PassThrough" errorMode="Detailed"></httpErrors>

This is because by default IIS7 intercepts HTTP status codes such as 4xx and 5xx generated by applications further up the pipeline.

Next, enable "Send Errors to Browser" under the "ASP" section, and under "Error Pages / Edit Feature Settings", select "Detailed errors".

Also, give Write permissions on the website folder to the IIS_IUSRS builtin group.

Martha
  • 3,932
  • 3
  • 33
  • 42
Niente00
  • 241
  • 2
  • 2
9

try setting the value of the "existingResponse" httpErrors attribute to "PassThrough". Mine was set at "Replace" which was causing the YSOD not to display.

<httpErrors errorMode="Detailed" existingResponse="PassThrough">
Dana Benson
  • 966
  • 7
  • 16
  • 2
    customErrors are for asp.net. httpErrors are for IIS7, and so handle content that doesn't go through the .net handler (e.g. .png, .js etc.) If you want error pages for non-.net content types, use IIS error pages (httpErrors for IIS7, the UI for IIS6.) The customErrors attribute is used when the .net code is throwing an exception (404, 403, 500 etc) and the httpErrors attribute is used when IIS itself is throwing an exception. This is because by default IIS7 intercepts HTTP status codes such as 4xx and 5xx generated by applications further up the pipeline. – Kiquenet Oct 06 '15 at 19:29
7

One thing nobody's mentioned is as a very quick and temporary fix, you can view the error on the localhost of that web server.

RandomUs1r
  • 4,010
  • 1
  • 24
  • 44
  • 1
    That's if the third option visible in [Vaclav's answer](http://stackoverflow.com/a/2765795/1680677) is selected. – ricksmt Apr 08 '14 at 15:30
3

Fot people who have tried EVERYTHING and just CANNOT get the error details to show, like me, it's a good idea to check the different levels of configuration. I have a config file on Website level and on Application level (inside the website) check both. Also, as it turned out, I had Detailed Errors disabled on the highest node in IIS (just underneath Start Page, it has the name that is the same as the webservers computername). Check the Error Pages there.

Jon Koeter
  • 1,005
  • 2
  • 16
  • 25
3

You may also verify that if you changed your main website folder (c:\inetpub\wwwroot) to another folder you must give read permission to the IIS_IUSRS group in the new folder.

Brian Ogden
  • 18,439
  • 10
  • 97
  • 176
1

Found it.

http://blogs.iis.net/ksingla/archive/2009/02/16/iis-7-5-updates-to-custom-errors-and-compression.aspx

run cmd as administrator, go to your system32\inetsrv folder and execute:

appcmd.exe set config -section:system.webServer/httpErrors -allowAbsolutePathsWhenDelegated:true

Now I can see detailed asp errors .

Jürgen Steinblock
  • 30,746
  • 24
  • 119
  • 189
egidiocs
  • 2,747
  • 3
  • 21
  • 20
1

If you run the browser in the server and test your url of the project with the local ip you have received all errors of that project without a generally error page(for example 500 error page).

Ali Rasouli
  • 1,705
  • 18
  • 25
0

In my case it was permission issue. Open application folder properties -> Security tab -> Edit -> Add

  • IIS AppPool\[DefaultAppPool or any other apppool] (if use ApplicationPoolIdentity option)
  • IUSRS
  • IIS_IUSRS
menkow
  • 627
  • 1
  • 8
  • 9
0

Double check the encoding of the asp file you are testing.

For instance if you created a file like below on a Windows Server Core 2019 :

echo "<%@ LANGUAGE=Javascript %>" > test.asp

echo "<%Response.Write("test");%>" >> test.asp

Then test.asp will be encoded in Unicode, and requesting it will produce a 500 without any details.

Do a notepad test.asp, then click on "Save As..." and choose "ANSI" encoding to fix it.

rodzmkii
  • 1,357
  • 1
  • 10
  • 7
0

In my case MariaDB was throwing an error.

It was only much later that it would send it over to Windows Logs > Application > Waring as

Aborted connection (number) to db: 'xxx' user: 'xxx' host: '127.0.0.1' (Got an error reading communication packets)

MeSo2
  • 450
  • 1
  • 7
  • 18