Debugging HTTP 500 errors

M

Marcel van Brakel

Hi,

I have an ASP.NET webservice that is working ok most of time, but quite
frequently the IIS log shows a status 500 being returned to the (.NET)
client. The problem is, I have no idea why this is happening. I'm logging
all SOAP requests/responses to a file using slightly modified example code
from MSDN (using a SOAP extension), and I don't see any faults happening
(I've already tried disabling the logging, didn't make a difference). The
SQL Server and Windows Event logs don't show anything out out of the
ordinary either. Does anybody have any advice on how to go about and debug
this kind of problem?

Some more details:

- Windows 2000 Server with the latest service pack and updates.
- .NET 1.1
- VS.NET 2003
- Webservice protected using basic authentication.
- SQL Server 2000 with the latest service pack and updates.

The webservice methods themselves don't really do anything exciting.
Basically just simple selects/inserts/updates on the SQL Server database.
Most of them are no more than 15 lines of code including error handling..

Help would be very much appreciated.

best regards,
Marcel van Brakel
 
M

Marcel van Brakel

Hmm, I think I need to get back to the basics. I completely forgot that
exceptions/faults are returned with status 500 (it also makes me reconsider
my usage of exceptions to signal valid error conditions). My questions still
stands though, sort of anyway. Suppose for a minute that these 500's weren't
the result of an exception, how would I go about and find out what is
causing them? Or put differently, since Application.OnError isn't triggered
for web services, are there any errors that won't be logged by the
SoapExtension, and can I somehow access those?

best regards,
Marcel van Brakel
 
M

[MSFT]

Hello Marcel ,

HTTP 500 error is a generic error which may be caused by many issues, for
example, authentication, internal code or even request/response size. From
your description, it seems to be a IIS issue, not related to your code. Can
you find anything wrong in system event log? Or you can enable more
extended loging options in IIS log, for example, service name, host and
bytes recieved, Can you found some common rules for the 500 error logged?

Luke
 
M

Marcel van Brakel

Luke,

Thanks for the quick response. It turned out that one of my methods was
throwing exceptions. Since this method didn't have logging turned on I
initially couldn't match those 500's to faults. I'm still wondering,
though, where exactly in the ASP.NET architecture/HTTP pipeline does a SOAP
extension plug in? Or put differently, are there any errors that might occur
within ASP.NET that I won't be able to see using a SOAP extension? And if
so, how can I monitor those?

best regards,
Marcel van Brakel
 
M

[MSFT]

Hi Marcel,

The pipeline of an ASP.NET web service is like:

HttpRequest ---> IIS ASP.NET Filter --> SOAP extension --> Web Service Class

Web Service Class --> SOAP extension --> IIS ASP.NET Filter --> HttpResponse

For more information about HTTP Pipelines in ASP.NET:

http://msdn.microsoft.com/msdnmag/issues/02/09/HTTPPipelines/default.aspx

To catch/hanlde an exception in the web service, I think the best way is
catch the exception in code ans throw a soapexception. You may refer to
following article to see if it will help:

Handling and Throwing Exceptions in XML Web Services
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/htm
l/cpconhandlingraisingexceptionsinxmlwebservices.asp

Luke
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top