IIS logs 200 status but returns 500 status

I'm trying to diagnose an issue where IIS7.5 shows a successful (200) response in the IIS logs, but a "Service temporarily unavailable" HTML message is returned to the browser with a 500 status, after 30 seconds.

Some more details:

  • I'm calling a WebAPI endpoint to run an import function that involves files and database entries.
  • The import takes anywhere from 40 - 70 seconds to complete.
  • The IIS 7.5 logs show the request completing successfully:

    2013-12-09 10:45:17 POST /api/streamdata/ImportStream - 80 [...] Mozilla/5.0+(Windows+NT+6.3;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/31.0.1650.63+Safari/537.36 200 0 64 1150 67120

  • The import code also logs the import steps and shows the import is completed successfully.

  • The browser receives an HTML page back, with the "Service Temporarily Unavailable" header and a 500 response code after 30 seconds.

  • Using .NET4.5

What I've tried:

  • Using Chrome and Firefox - same result either way.
  • Adding a timeout to the jQuery AJAX request. If this is set short (30 seconds) I get an actual timeout reported. If this is set long (5 minutes) I get the service unavailable message as before.
  • Using Fiddler client-side, and can see the server is responding with the 500 code (rather than it being something generated client-side).
  • Checked out various IIS site and application-pool settings, but can't find one that explains this behaviour.
  • Adjusted the import code to miss out some steps and take less than 30 seconds to complete. In this case a normal 200 response was received by the browser.

So in summary, the code is running ok, but a service temporarily unavailable message is returned to the browser at 30 seconds into the request, even though the server is still happily processing the request to completion.

Any ideas on what is happening at 30 seconds and how to fix it gratefully received.


Thanks to the steer from Guntram I found the issue was a 30 second timeout in the load-balancer, which was where the HMTL error page was originating.

Once Rackspace increased the timeout period, everything worked normally again.

Need Your Help

How can I get the number of pages in a PDF file in Perl?

perl pdf pdflib

Is there any Perl script to read multiple PDF files and get the number of pages in it?

Inner div not stretching to outer div even with parent set as 100%

css html5 css3 twitter-bootstrap

Maybe I'm just tied and overlooking something really simple, but it seems my inner divs are not stretching to their parent element even though I have height:100% set for both the children and the p...