1) We have Windows Service Application which calls Web service every specific time period. We have logic that only one web service instance will be running at a time. See the following code is from Window Service which calls web service.
/// <summary> /// Timer Event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CIMAutoUpdateTimer_Elapsed(object sender, ElapsedEventArgs e) { try { //check any webservice instance exist or not //isWebServiceInstaceExist = false means no webservice instance exist you can create new one if(isWebServiceInstaceExist ==false) { //Set WebServiceInstaceExist = true so no webservice instance will be created before response of this webservice retunrns isWebServiceInstaceExist =true; //create webservice instance CIMAutoUpdateInterface cimInterface = new CIMAutoUpdateInterface();
//get timeout from config cimInterface.Timeout = Convert.ToInt32(ConfigurationSettings.AppSettings["CIMAutoUpdateTimeOut"]); //call web method InterfaceResponse interFaceResponse = cimInterface.ProcessRecords();
//log return Response objLogger.Info("Web Service Response :: " + interFaceResponse.Response);
//Set WebServiceInstaceExist = false so new webservice instance will be created isWebServiceInstaceExist =false; } else { objLogger.Info("Web Service instace Already Exist :: "); }
} catch( Exception exc) { isWebServiceInstaceExist =false; objLogger.Info("Exception Occurred in the event." + "Exception Message::" + exc.Message + " Stack Trace ::" + exc.StackTrace); } }
|
2) now if one web service instance runs for more than one Hours we are getting exception in window service as follows
2006-03-09 10:42:46,691 [2844] INFO CIMAutoUpdateLogger [] – Exception Occurred in the event.Exception Message::The underlying connection was closed: An unexpected error occurred on a receive. Stack Trace :: at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request)
at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest request)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at CIMAutoUpdateService.CIMAutoUpdateService.CIMAutoUpdateInterface.ProcessRecords()
at CIMAutoUpdateService.CIMAutoUpdate_Test.CIMAutoUpdateTimer_Elapsed(Object sender, ElapsedEventArgs e)
Ø I have searched for this error on Net and found solution that you needs to set KeepAlive = False in GetWebRequest method. I have done this as well still above error is coming on deployment server.
Ø Now above error comes only on deployment server only which is having Windows 2003 server as OS. But I have tested locally with window XP and window 2003 Server. With the both OS there is no error coming locally. Even both local and deployment server is having same .Net Framework installed (1.1 SP1)
Ø One more observation is that only if web service instance runs more than one hour than above exception is generated other wise application runs smoothly. But I have checked all settings in server and configuration there is no where 1 hours time out setting at all.
Now problem is that web service is going to update so many records at time so most of the time our web method will be running more than 1 hour
Well I have seen one Kb article on following link which says its .net Bug but since its working fine locally I do not think this is anything related to .net framework
any Comments ??
Save time by starting a search from any Web page with the MSN Search Toolbar-FREE!
Greetings from Shanghai.
AN INVITATION FOR
YOU TO THE PRESTIGIOUS BILLIONAIRES CLUB
Hi there
This is a personal invitation for you to become a member of
the prestigious billionaires club.
Membership is free, and all you have to do is place a
link from your space to mine and in return, your name and a link to your space
will be added to the Billionaires Club Membership list for all to see
We are looking forward to having you as one our newest
members
CLICK
HERE TO BECOME A MEMBER
The 1 Billion Comments Project
The Home Of The Comment