I create a small program that can grab information from Exchange Calendar Notes if someone is put my qwe code in there.
I am using C# and .NET 4.0 framework in Visual Studio.
My program will connect via Exchange Web Service to search and collect the information of my qwe code are put in there by someone in our team member.
I create an interval every 6 minute to do this search job.
All is working good and fine in 3 week ago, but now is intermittent - sometime the connection is fail and say:
Microsoft.Exchange.WebServices.Data.ServiceRequestException: The request failed. The underlying connection was closed: An unexpected error occurred on a send.
System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send
Below are the status log that my program in about 30 minutes run (1 of the checks failed).
My question: what is the cause that makes the connection to EWS fail and causing this error?
Any suggestion so I can make my program better and not show again below fail message?
Thank you,
Gedhe ND
16:06:50 ------------------------------------------------------------
16:06:50 TempJob OL search is finished!
16:06:50
16:06:49
16:06:49 FOUND QWE(Space)G9 in OUTLOOK within 32 days
16:06:49
16:06:48 Found 129 appointments within 32 days
16:06:44 Exchange service successfully connected!
16:06:44 Initializing connection to EWS, please wait...
16:06:44
16:00:44 ------------------------------------------------------------
16:00:44 TempJob OL search is finished!
16:00:44
16:00:44 OL Error: Microsoft.Exchange.WebServices.Data.ServiceRequestException: The request failed. The underlying connection was closed: An unexpected error occurred on a send. ---> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
at System.Net.Sockets.Socket.EndReceive(IAsyncResult asyncResult)
at System.Net.Sockets.NetworkStream.EndRead(IAsyncResult asyncResult)
--- End of inner exception stack trace ---
at System.Net.TlsStream.EndWrite(IAsyncResult asyncResult)
at System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar)
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.GetResponse()
at Microsoft.Exchange.WebServices.Data.EwsHttpWebRequest.Microsoft.Exchange.WebServices.Data.IEwsHttpWebRequest.GetResponse()
at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.GetEwsHttpWebResponse(IEwsHttpWebRequest request)
--- End of inner exception stack trace ---
at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.GetEwsHttpWebResponse(IEwsHttpWebRequest request)
at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.ValidateAndEmitRequest(IEwsHttpWebRequest& request)
at Microsoft.Exchange.WebServices.Data.MultiResponseServiceRequest`1.Execute()
at Microsoft.Exchange.WebServices.Data.ExchangeService.BindToFolder(FolderId folderId, PropertySet propertySet)
at Microsoft.Exchange.WebServices.Data.ExchangeService.BindToFolder[TFolder](FolderId folderId, PropertySet propertySet)
at Microsoft.Exchange.WebServices.Data.CalendarFolder.Bind(ExchangeService service, WellKnownFolderName name, PropertySet propertySet)
at GH_TempJob.FormTempJob.checkOL_tempjob(String searchKey)
16:00:43 Exchange service successfully connected!
16:00:43 Initializing connection to EWS, please wait...
16:00:43
15:54:43 ------------------------------------------------------------
15:54:43 TempJob OL search is finished!
15:54:43
15:54:42
15:54:42 FOUND QWE(Space)G9 in OUTLOOK within 32 days
15:54:42
15:54:42 Found 129 appointments within 32 days
15:54:38 Exchange service successfully connected!
15:54:38 Initializing connection to EWS, please wait...
15:54:38
15:48:38 ------------------------------------------------------------
15:48:38 TempJob OL search is finished!
15:48:38
15:48:37
15:48:37 FOUND QWE(Space)G9 in OUTLOOK within 32 days
15:48:37
15:48:37 Found 129 appointments within 32 days
15:48:31 Exchange service successfully connected!
15:48:30 Initializing connection to EWS, please wait...
15:48:30
15:42:30 ------------------------------------------------------------
15:42:30 TempJob OL search is finished!
15:42:30
15:42:30
15:42:30 FOUND QWE(Space)G9 in OUTLOOK within 32 days
15:42:30
15:42:29 Found 129 appointments within 32 days
15:42:24 Exchange service successfully connected!
15:42:24 Initializing connection to EWS, please wait...
15:42:24
15:42:18 Logged you in as Gedhe