title: Server returns 500 code but can't trap error
body: <p>I have an ASP.NET web service running in IIS, on a Windows 2003 server.</p>
  
  <p>Here are the IIS logs for a call I had done using another .NET program.  It correctly responded to my application with "Hello World"</p>
  
  <pre><code>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
  </code></pre>
  
  <p>Here is the IIS log for a call done from an RPG program... which is sending back "500" "Internal Server Error"</p>
  
  <pre><code>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
  </code></pre>
  
  <h2>------------------</h2>
  
  <h2>------------------</h2>
  
  <p>My Global.asax Application_Start and Application_Error are both coded to log a message when they are hit.</p>
  
  <p>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.</p>
  
  <p>HelloWorld only initializes a logger and returns the string "Hello World".  And... the log is getting written in both calls.</p>
  
  <p><strong>So... how do I trap whatever error is occurring?</strong> which is sending back the 500 code.</p>