Posts Web Service Woes (Plea For Help!!!!)
Post
Cancel

Web Service Woes (Plea For Help!!!!)

OK, I'm getting to the end of the rope on this one.  I've tried everything that I can think of and have searched google a hundred times over... all to no avail. 

I have two applications, one is a windows form application and the other a web service application.  On some machines (starting about a month or so ago) the web service call will just “stop working” and cause the CPU usage to peg out at 100% until the web service call times out (since I'm using a synchronous call).  No other clues to this problem other than this occurring.  However, if I run the application in VS.NET in debug mode, an error will occur.  After a web service call completes and no further call occurs... sometime between five and six minutes after that last call the following error will be displayed:

<FONT color=#ff0000>Unhandled exception of type 'System.NullReferenceException' occurred in system.dll </FONT>

The problem with this error, beyond the fact that it doesn't show up in release mode, is that it can't be handled!?!?!  Also, the error is occurring within the FCL within the System.Net.Sockets.OverlappedAsyncResult.CompletionPortCallback method.  I've even attempted to use a Sub Main and add an event handler to capture all unhandled errors by doing the following:

<FONT color=#0000ff>Public Shared Sub Main()
  <FONT color=#0000ff>Dim</FONT> currentDomain <FONT color=#0000ff>As</FONT> AppDomain = AppDomain.CurrentDomain
  AddHandler currentDomain.UnhandledException, <FONT color=#0000ff>AddressOf</FONT> MyHandler
  Application.Run(<FONT color=#0000ff>New</FONT> Form1)
<FONT color=#0000ff>End Sub</FONT></FONT>

<FONT color=#0000ff>Private Shared Sub MyHandler(<FONT color=#0000ff>Byval</FONT> sender <FONT color=#0000ff>As</FONT> Object, <FONT color=#0000ff>Byval</FONT> e <FONT color=#0000ff>As</FONT> UnhandledExceptionEventArgs)
  <FONT color=#0000ff>Dim</FONT> ex <FONT color=#0000ff>As</FONT> Exception = <FONT color=#0000ff>DirectCast</FONT>(e.ExceptionObject, Exception)
  MsgBox(ex.Message)
<FONT color=#0000ff>End Sub</FONT></FONT>

So, I've trimmed down the application to the bare minimum that will this error will occur in.  Basically, it's a Windows Form application where the Form_Load event makes a call the web service and the web service consists of a single method that accepts a string and integer (doing nothing within the method).  To test more accurately what the full blown application is doing, I've added a timer that occurs every 10 minutes to make the web service call again.

If I change the timer to occur every minute, the symptom appears to go away, but does appear to occur randomly sometime later within a several hours.

If any web service experts are reading this and are willing to help me with this problem, I can provide some sample code that can reproduce this.  Any help would be much appreciated.

This post is licensed under CC BY 4.0 by the author.