1

I have an ASP.NET web service running in IIS, on a Windows 2003 server.

Here are the IIS logs for a call I had done using another .NET program. It correctly responded to my application with "Hello World"

2013-03-25 19:38:36 W3SVC1406312275 VMC-MMS 192.168.1.223 POST /test.asmx wsdl/mex 80 - 172.16.129.193 HTTP/1.1 - - - webservices.vm.vmc 500 0 0 775 677 1671
2013-03-25 19:38:36 W3SVC1406312275 VMC-MMS 192.168.1.223 GET /test.asmx wsdl 80 - 172.16.129.193 HTTP/1.1 Mozilla/4.0+(compatible;+MSIE+6.0;+MS+Web+Services+Client+Protocol+2.0.50727.5466) - - webservices.vm.vmc 200 0 0 3103 183 2531
2013-03-25 19:38:36 W3SVC1406312275 VMC-MMS 192.168.1.223 POST /test.asmx wsdl 80 - 172.16.129.193 HTTP/1.1 - - - webservices.vm.vmc 500 0 0 775 645 250

Here is the IIS log for a call done from an RPG program... which is sending back "500" "Internal Server Error"

2013-03-25 21:10:26 W3SVC1406312275 VMC-MMS 192.168.1.223 POST /test.asmx - 80 - 192.168.1.6 HTTP/1.1 http-api/1.24 - - webservices.vm.vmc 500 0 0 697 32968 2421

------------------

------------------

My Global.asax Application_Start and Application_Error are both coded to log a message when they are hit.

Calls from both .NET and RPG write to the log file in the Application_Start function... but neither writes to the log in the Application_Error function.

HelloWorld only initializes a logger and returns the string "Hello World". And... the log is getting written in both calls.

So... how do I trap whatever error is occurring? which is sending back the 500 code.

adam
  • 2,930
  • 7
  • 54
  • 89
  • I see you're using WSDL with ASMX files - are you using a web-services framework on top of ASP.NET? – Dai Mar 25 '13 at 21:42
  • Yes we are running IIS with .NET Framework 2.0 – adam Mar 25 '13 at 21:44
  • I can see that, but is your application using WCF or some other framework **on top** of ASP.NET? – Dai Mar 25 '13 at 21:49
  • Did you check the Event Viewer to see if any ASP.NET errors are getting logged there? – rsbarro Mar 25 '13 at 21:53
  • @Dai I just go to Add New Item -> Web Service. Not WCF Service or any other option. Sorry if i'm still missing the question. – adam Mar 25 '13 at 21:59
  • @rsbarro I see various things in System... but the particular error about "Duplicate name on the TCP network" has been happening before my tests. Inside Application there are a few errors, but nothing since noon and I've been testing a lot since then... so I guess.... no. – adam Mar 25 '13 at 22:03

1 Answers1

1

Unfortunately, Application_Error does not fire for unhandled exceptions in web services.

Check the answers to this question for more information. You're going to have to do something like either add a try-catch to each web method, or create a SOAP extension to handle the web service exceptions.

I would probably go the SOAP extension route and create an extension I could use in all my projects as a generic web service exception handler.

UPDATE
One of the answers to this question has a SOAP extension code example.

Community
  • 1
  • 1
rsbarro
  • 27,021
  • 9
  • 71
  • 75