none
Question about EWS - The operation has timed out RRS feed

  • Question

  • hi everyone,

    I'm developing a solution which uses public folder database in Exchange Server to store tasks:

    - We use 1 account to access to public folder database by using EWS.

    Application Architect

    - Currently, this public folder database contains 60000 tasks and they are being accessed by 700 users, they always have the following exception: 

    04/23/2015 09:41:15:  - The request failed. The operation has timed out
    Message :The request failed. The operation has timed out
    Source :Microsoft.Exchange.WebServices
    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.FindItems[TItem](IEnumerable`1 parentFolderIds, SearchFilter searchFilter, String queryString, ViewBase view, Grouping groupBy, ServiceErrorHandling errorHandlingMode)
       at Microsoft.Exchange.WebServices.Data.ExchangeService.FindItems(FolderId parentFolderId, SearchFilter searchFilter, ViewBase view, Grouping groupBy)

    Please help.

    Thanks a lot.

    Phuc

    Tuesday, April 28, 2015 2:52 AM

All replies

  • I would suggest you post some of the code your using, but I'll can only surmise that you getting the timeout because your querying a reasonable large number of items and the Search your using is too complex so you asking the server to do to much work.

    To fix it you might want to consider making your search less complex and getting rid of the grouping. This will generally have two effects the results set you get back will be larger and you may have to do more work at the client before you present your result to the client but it should reduce the amount of work the server needs to do to return the results to you and hence fix the timeout. Doing the grouping yourself at the client side shouldn't be a big deal and your gaining little by doing this at the server. The searchfilter maybe a little more complex but it really depends what your searching on. One of the problem with Searching public folder on 2010 is that they aren't included in the content indexing.

    Cheers
    Glen

    Tuesday, April 28, 2015 4:14 AM
  • Thanks Glen for your reply.

    Here is a code block which retrieve the number of task of some groups

    foreach (var bu in request.BusinessUnits)
                {
                    SearchFilter businessUnitFilter = new SearchFilter.IsEqualTo(BusinessUnitAliasProp, bu);//, ContainmentMode.FullString, ComparisonMode.IgnoreCase);
                    SearchFilter[] filters = new SearchFilter[] { actualOwnerFilter, statusFilter, businessUnitFilter };
                    var filterCollection = new SearchFilter.SearchFilterCollection(LogicalOperator.And, filters);
                    GroupedFindItemsResults<Item> taskResults = this.exchangeService.FindItems(_publicFolderId, filterCollection, itemView, groupByApplication);
    
                    if (taskResults != null && taskResults.ItemGroups != null)
                    {
                        foreach (var groupItem in taskResults.ItemGroups)
                        {
                            if (!dict.ContainsKey(groupItem.GroupIndex))
                            {
                                dict.Add(groupItem.GroupIndex, new Dictionary<string, int>());
                            }
                            if (!dict[groupItem.GroupIndex].ContainsKey(bu))
                            {
                                dict[groupItem.GroupIndex].Add(bu, groupItem.Items.Count);
                            }
                        }
                    }
                }

    Please let me know if it's too complex and might affect to the performance of Exchange Server

    Tuesday, April 28, 2015 9:05 AM
  • If the Search is timing out that's a pretty good indication its too complex, Every Search Filter you add is adding more complexity and comes at a performance cost. Substring Searches are very costly in terms of performance also and should be avoided. Like any database the larger the number of Items you have the more predicates you use in a query is going to make the process slower

    My suggestion is get rid of the grouping and start with just one search filter and test the performance and see if you still get the timeouts (then add the others in gradually) . You should also look at each search filter and see if its actually useful. Eg if the search filter only reduces the number of records in the results by a very small amount you would be better just to filter the results at the client side.

    Other things you could do is look at the EWSLog on the server which may report some more information but it looks like the client is timing out rather then the server so you could adjust that timeout.

    Cheers
    Glen 

    Wednesday, April 29, 2015 2:38 AM