3

I have a web service that has been running for years. Today, someone told me it was giving server error 500. I checked the server logs for the past several months and it seems that I'm getting a status of 200 for 99% of the calls to the service and then a few 500's every now and again to spice things up. The server log itself is a bit hefty to read, so I tried to reduce it a little without changing anything important.

Here is an extract from the server log:

2013-09-16 09:58:19 <Server IP> GET /WebServicePath/WebService.asmx - 80 - <Server IP> <User Agent String> 200 0 0 874
2013-09-16 09:58:22 <Server IP> GET /WebServicePath/WebService.asmx op=MyFunction 80 - <Server IP> <User Agent String> 200 0 0 203
2013-09-16 09:58:35 <Server IP> POST /WebServicePath/WebService.asmx/MyFunction - 80 - <Server IP> <User Agent String> 500 0 0 437
2013-09-16 09:58:42 <Server IP> POST /WebServicePath/WebService.asmx/MyFunction - 80 - <Server IP> <User Agent String> 500 0 0 0
2013-09-16 09:58:53 <Server IP> POST /WebServicePath/WebService.asmx/MyFunction - 80 - <Server IP> <User Agent String> 200 0 0 499
2013-09-16 09:59:05 <Server IP> POST /WebServicePath/WebService.asmx/MyFunction - 80 - <Server IP> <User Agent String> 200 0 0 203
2013-09-16 09:59:11 <Server IP> POST /WebServicePath/WebService.asmx/MyFunction - 80 - <Server IP> <User Agent String> 200 0 0 187
2013-09-16 09:59:16 <Server IP> POST /WebServicePath/WebService.asmx/MyFunction - 80 - <Server IP> <User Agent String> 200 0 0 296
2013-09-16 10:03:17 <Server IP> POST /WebServicePath/WebService.asmx/MyFunction - 80 - <Server IP> <User Agent String> 500 0 0 15

The HTTP status is the fourth number from the right.

The server is IIS7 and the user agent string used is this:

Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+6.1;+WOW64;+Trident/5.0;+SLCC2;+.NET+CLR+2.0.50727;+.NET+CLR+3.5.30729;+.NET+CLR+3.0.30729)

I checked Event Viewer for anything logged at the times when I got the 500s, but found nothing.

I found many examples of people getting server error 500 on newly-deployed services and they normally have an assembly issue. But why on earth would it just randomly give 500 and be fine otherwise?

Cobus Kruger
  • 8,338
  • 3
  • 61
  • 106
  • Why would these errors be random ? First thing to do would be to log more information when error happens. [This link](http://stackoverflow.com/questions/211530/why-global-asax-application-error-method-does-not-catch-exceptions-thrown-by-asm) might be useful. – Marshall777 Sep 16 '13 at 14:27
  • I'm getting this too. Would love to know if you ever figured this out. – Jordan Parker Jun 17 '16 at 14:01
  • @JordanParker In my case it surprisingly turned out to be file permissions. The service would use the connecting AD user to access a particular folder, which turned out to be a problem for the two users in one offshore office. I fixed it by removing that dependency, but could have done so by either granting admin rights to the web service user and always using that, or adding the permissions to the AD user. I was rather disappointed that it turned out to be so mundane ;) – Cobus Kruger Jun 17 '16 at 14:09
  • Thanks @CobusKruger! I'm thinking it might be something similar for me. I really appreciate the postmortem. :) – Jordan Parker Jun 17 '16 at 14:16

1 Answers1

1

A 500 HTTP Status code just means Internal Error. It means that the web application threw an uncaught exception of any kind.

This could be due to any problem where the code gets an unexpected value. So, there is not much to go on just knowing that a 500 is being thrown.

Usually, something would be thrown into the event viewer (application log) under ASPNET application.

Application logging (NLog, Log4Net, ELMAH), usually has some sort of catch-all at the top of the process to log out the exact type and message of the exception. This is the type of information you need to investigate further.

Davin Tryon
  • 66,517
  • 15
  • 143
  • 132
  • I already checked the application log for errors around the same time and that was fruitless. I'll look ASPNET - perhaps it doesn't get logged immediately? Weird. – Cobus Kruger Sep 16 '13 at 14:45