IIS7 is throwing a 500 error intermittently. Can anyone help me diagnose it?

4

Sorry for the vague title, as I really can't explain this problem succinctly.

Basically I have Windows Server 2008 x64, IIS7, ASP.NET 2.05, and I have a site running in a Classic AppPool (and no I cannot run in Integrated).

When trying to load an *.aspx file for the first time (i.e. after installing site, restarting the server, etc) I get this error:

HTTP Error 500.0 - Internal Server Error
The page cannot be displayed because an internal server error has occurred.
Module: IsapiModule
Notification: ExecuteRequestHandler
Handler: PageHandlerFactory-ISAPI-2.0-64
Error Code: 0x800710dd
Logon Method: Anonymous
Logon User: Anonymous

The handler is the default IIS7 one:

<add name="PageHandlerFactory-ISAPI-2.0-64" path="*.aspx" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness64" responseBufferLimit="0" />


I even tried adding in my own handler for aspx that looked like this:

<add name="aspx" path="*.aspx" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" resourceType="Unspecified" preCondition="classicMode,runtimeVersionv2.0,bitness64" />

The only thing that did was change the Handler part of the error notification to say IsapiModule.

The odd thing is that this error only occurs the first time (or when the server has been idle for hours). As soon as I see this error, if I refresh the page it's all fine and dandy again.

I even tried deleting the web.config file and that did absolutely nothing.

I can't seem to find a single answer for this problem on the internet.

Edit: I enabled Failed Request Tracking and this is what it shows:

MODULE_SET_RESPONSE_ERROR_STATUS Warning ModuleName="IsapiModule", Notification="EXECUTE_REQUEST_HANDLER", HttpStatus="500", HttpReason="Internal Server Error", HttpSubStatus="0", ErrorCode="The operation identifier is not valid. (0x800710dd)", ConfigExceptionInfo=""

And right before the error it shows:

NOTIFY_MODULE_START ModuleName="IsapiModule", Notification="EXECUTE_REQUEST_HANDLER", fIsPostNotification="false", fIsCompletion="false"

Now when I compare this to a successful run the difference is that the error produces MODULE_SET_REPONSE_ERROR_STATUS whereas the successful run doesn't (and then goes on to produce the correct HTML output).

Edit: I took a simple app and tried to get that running and I received the same error. But when the apppool was in Integrated mode it ran fine! Unfortunately I cannot migrate our app to integrated for reasons I cannot specify but I narrowed it down to the app pool. Also I don't have to restart the server to repro the error, instead recycling the app pool will do.

Summary:
- As mentioned below there's nothing in the Event Logs to indicate failure. I combed through all logs in Event Viewer

asp.net
iis-7
asp.net-2.0
isapi
asked on Stack Overflow Aug 6, 2009 by encee • edited Oct 6, 2009 by Joel Coehoorn

6 Answers

3

Best thing to do is enable Failed Request Tracing in the IIS section of the web site. You can then enable some filters which give you much more detailed information.

You can do this through the IIS Manager. Click your web site, then in the IIS section of the Features View, double-click "Failed Request Tracing Rules".

It's most likely not already enabled, so from the rightmost column select "Edit Site Tracing". Check the "Enable" checkbox and make note of the directory.

You can then either add a rule in that screen or go to your application and open the "Failed Request Tracing Rules" IIS feature from there.

From the rightmost column again, click "Add..." Then go through the wizard and set up the logging.

Load your page that's throwing the error again. Go to the logging folder and double-click the XML file. There's an XSL in that directory. Don't nuke it, cuz once it's gone it won't get recreated. :s The transformed XML will show you more info than you can possibly hope for.

I just this evening used that to discover a custom error page that I configured was using ~/ instead of "/", causing IIS to die.

answered on Stack Overflow May 24, 2011 by Edward
1

When ASP.NET application starts loading, you may have some code that may take too long to execute, probably too big application variables or resources initialization.

The best way is to setup some sort of ping monitor, lot of ISPs provide pinging monitors that can monitor your html url on regular interval, that may help keeping your application all time alive !!

Try looking into initialization procedures of your asp.net app, you may want to increase some timeout values !!

answered on Stack Overflow Aug 6, 2009 by Akash Kava
0

Sounds like something while starting up the app pool. But it should be logging the actual error in the event viewer. Or you could turn CustomErrors off to debug it. The thing is, you need to see the actual error to figure out what's going on.

answered on Stack Overflow Aug 6, 2009 by marcc
0

Do you have an unhandled exception handler in your ASPX code (something like Global Application_Error)?

You should be able to catch the exception and log it if it's coming from the ASPX code (which is quite possible).

I've seen sporadic errors like this before, I just can't remember the underlying cause at the moment.

How to: Handle Application-Level Errors

answered on Stack Overflow Aug 6, 2009 by Michael Maddox • edited Jun 20, 2020 by Community
0

Well I don't know what was causing this but a clean install of the VM I was using fixed it. Hurrah!

answered on Stack Overflow Aug 27, 2009 by encee
0

You must add this script on your web.config:

<system.webServer>
    <handlers>
        <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    </handlers>

I hope this help ! Cheer.

answered on Stack Overflow Sep 28, 2013 by xmencute

User contributions licensed under CC BY-SA 3.0