EWS streaming Subscription timed out on connection open

I am currently troubleshooting an issue with Exchange Web Services. The problem is when opening a streaming subscription connection (via a StreamingSubscriptionConnection object) the operation hangs when the Open method is called. Here is the code that hangs for reference:

_streamingSubscriptionConnection = new StreamingSubscriptionConnection(_exchangeService, _connectionLifetime);
_streamingSubscriptionConnection.AddSubscription(_subscription);
_streamingSubscriptionConnection.OnNotificationEvent += new StreamingSubscriptionConnection.NotificationEventDelegate(OnNotificationEvent);
_streamingSubscriptionConnection.OnSubscriptionError += new StreamingSubscriptionConnection.SubscriptionErrorDelegate(OnSubscriptionError);
_streamingSubscriptionConnection.OnDisconnect += new StreamingSubscriptionConnection.SubscriptionErrorDelegate(OnDisconnect);
_streamingSubscriptionConnection.Open();

      

It usually takes about two minutes and then displays a message ServiceRequestException

that says:

Request failed. The operation is complete.

It's also worth mentioning that even if I set the timeout for a minute, it will take even more than a minute and then throw this exception. The call never misses the Open command.

My questions are: has anyone encountered this in the past? Also, are there any tools that I can use to diagnose any connectivity issues to determine if the exception is over, the end of the Exchange server, or somewhere in between? I've tried Fiddler and Microsoft Network Monitor looking for any patterns, but it's hard for me to figure it out all the time.

Thanks in advance!

EDIT: To add to this, if I add a trace listener, I get quite a few results. I can see that it is retrieving the subscription id and then trying to connect. When it sends a connection request, this is what is logged between the time the Open command is issued and the timeout:

<Trace Tag="EwsRequestHttpHeaders" Tid="10" Time="2013-01-24 19:16:18Z">
      POST /ews/exchange.asmx HTTP/1.1
      Content-Type: text/xml; charset=utf-8
      Accept: text/xml
      User-Agent: ExchangeServicesClient/14.03.0032.000
      Accept-Encoding: gzip,deflate      
</Trace>

<Trace Tag="EwsRequest" Tid="10" Time="2013-01-24 19:16:18Z" Version="14.03.0032.000">
    <?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
        <soap:Header>
            <t:RequestServerVersion Version="Exchange2010_SP1" />
        </soap:Header>
        <soap:Body>
            <m:GetStreamingEvents>
                <m:SubscriptionIds>
                    <t:SubscriptionId>GABsdGNmaXN3bXNnY2EwNi5mbmZpcy5jb20QAAAAnQCowdNSt0iTEhqVr8+a1GPHu2t+yM8I</t:SubscriptionId>
                </m:SubscriptionIds>
                <m:ConnectionTimeout>30</m:ConnectionTimeout>
            </m:GetStreamingEvents>
        </soap:Body>
    </soap:Envelope>
</Trace>

      

I am trying to rule out networking problems but I am having a hard time doing it. Any advice is greatly appreciated at this stage.

+3


source to share


2 answers


For those following me, this question was not related to .Net or EWS library.

The problem is related to the save settings on load balancers in our company. With our load balancers, if any persistence is allowed for streaming EWS subscription calls, these connections will fail. Unfortunately, at a time when I didn’t know that there was load balancing between me and the Exchange server because the developers didn’t have access to this infrastructure.



Whatever, hope this helps someone in the future!

+6


source


It happens to me when I add many subscribers to a connection that it takes a long time to open the connection. Try increasing the number _connectionLifetime

to 20 minutes and see what happens.



+1


source







All Articles