Tuesday, March 26, 2013

Failed Web Service Call Due to Big Time Difference Between Servers

The other day, a working web site was suddenly down. Its registration and login related functionalities were all failed.
The error was caught but the error message was kind of “Unknown”. Dug to the code, the caught exception “e” in below code is a null:
   1:  try
   2:  {                   
   3:      return client.Proxy.IdentityTypeList();
   4:   }
   5:  catch (Exception e)
   6:  {
   7:      this.HandleException(e);
   8:   }

what line 3 does is calling a web service, but it was failed and throwing an null exception. As there was no message text at all, it seemed it was getting into a dead end in for trouble shooting.

It finally turned out it was caused by there was a big time different between the tow machines (the calling web server and the web service server). The difference was more than 5 minutes.

What I have done to find out the cause was I wrote a test program in C#. The test program was a WinForm application. The function of the application was to call the same web service as above code did.

When the application was deployed to the web service, it failed to call the web service and threw an exception. This time the exception did have a error message text complaining that the web service returned in future time and the time in the future was longer than 5 minutes.

What is still mystery to me from the above case is that the same code in Web application and WinForm application throws different exception. The exception threw in Web application does not make sense at all which make it very difficult to do the trouble shooting.

No comments:

Post a Comment