taracus
taracus

Reputation: 393

IIS 8 Server error 500 logs

So we decided to try out the new Windows Server 8 / IIS 8. Running in VS-Dev server I simply catch all server errors in Application_Error() in Global.asx and log these using log4net.

Now I have 2 problems, first is the exceptions doesnt seem to be caught in Application_Error() on our deveolpment server (as the server returns a statuscode of 500 to the browser). Second is that my log4net doesnt log anything from the Webapplication.

Its a mvc 3.0 asp.net application using razor views. My local machine is running Windows 7 / VSUltimate 2012.

Trust-level set to Full and the IIS_IUSRS usergroup have full access to the folder where im trying to write the log-files.

What I really want is to just log the exceptions somewhere so if theres a built in way of doing this in IIS 8 please let me know. (Maybe redirect to some error controller which gets the exception as a parameter?)

Cheers Tomas

Upvotes: 1

Views: 4908

Answers (1)

andypaxo
andypaxo

Reputation: 6621

I'm having a very similar problem after upgrading to Windows Server 2012 / IIS 8.

The exceptions are being added to the Windows event log. Open Event Viewer from the start menu, expand Windows > Application on the left and look for events in the "Web Event" category.

On our server the following change fixed the problem:

In IIS Manager, go to ".NET Error Pages", then on the right choose "Edit Feature Settings..." and change Mode to either On or Remote Only.

enter image description here

Upvotes: 3

Related Questions