Quantcast
Channel: Exchange Server Development forum
Viewing all articles
Browse latest Browse all 7132

ServiceRequestException : The request failed. The operation has timed out

$
0
0

I wrote simple client using EWS Managed API. And let it run for one night. It was working fine. But when I checked it back in the morning, I found my application stopped. I checked logs I got following exception:

2014-01-08 01:49:05.3649 | Error | Exception while fetching mails : The request failed. The operation has timed out | MyNamespace.MyClass.myMethod

                      Immediate Stack Trace 
===================================================================================
Microsoft.Exchange.WebServices.Data.ServiceRequestException : The request failed. The operation has timed out
   at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.GetEwsHttpWebResponse(IEwsHttpWebRequest request)
   at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.ValidateAndEmitRequest(IEwsHttpWebRequest& request)
   at Microsoft.Exchange.WebServices.Data.SimpleServiceRequestBase.InternalExecute()
   at Microsoft.Exchange.WebServices.Data.MultiResponseServiceRequest`1.Execute()
   at Microsoft.Exchange.WebServices.Data.ExchangeService.InternalLoadPropertiesForItems(IEnumerable`1 items, PropertySet propertySet, ServiceErrorHandling errorHandling)
   at Microsoft.Exchange.WebServices.Data.ExchangeService.LoadPropertiesForItems(IEnumerable`1 items, PropertySet propertySet)
   at MyNamespace.MyClass.myMethod() in c:\MyProject\MyClass.cs:line 190


     Inner Exception 1 : Stack Trace
-----------------------------------------------------------------------------
The operation has timed out
   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)

Since the Exception message did not contain error code that Exchange server usually returns like (401) Unauthorized or (403) Forbidden, I am unable to pinpoint any reason for this to occur, since the functionality worked perfectly several times before this exception occurred as I can check in my logs. Also my diagnostic class which runs on the occurrences of any exception immediately tried to ping exchange server and re-initialize ExchangeService object. When I checked diagnostics logs after this exception time for the result of diagnostics, then it was able to ping the exchange server and the ExchageServer object also initialized successfully. So I am out of any reason now. 

The exception occurred on the last line of the following code:

ItemView itemView = new ItemView(100, 0);
FindItemsResults<Item> itemResults = null;
PropertySet psPropSet = new PropertySet(BasePropertySet.IdOnly);
itemView.PropertySet = psPropSet;
PropertySet itItemPropSet = new PropertySet(BasePropertySet.IdOnly) 
                                            { 
                                              ItemSchema.Attachments,
                                              ItemSchema.Subject,                                               
                                              ItemSchema.Importance,
                                              ItemSchema.DateTimeReceived,
                                              ItemSchema.DateTimeSent,
                                              ItemSchema.ItemClass,
                                              ItemSchema.Size,
                                              ItemSchema.Sensitivity,
                                              EmailMessageSchema.From,
                                              EmailMessageSchema.CcRecipients,
                                              EmailMessageSchema.ToRecipients,                                           
                                              ItemSchema.MimeContent
                                            };                
itemResults = service.FindItems(WellKnownFolderName.Inbox, itemView);
if (itemResults.Items.Count != 0)
       service.LoadPropertiesForItems(itemResults.Items, itItemPropSet);

Any guesses why this could have happened? Or just some random network congestion? Am I forgetting to log some more information. Should I also log Exception.Data or something else?


Viewing all articles
Browse latest Browse all 7132

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>