加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c# – 打开连接时的Exchange Web服务流式订阅超时

发布时间:2020-12-16 01:52:45 所属栏目:百科 来源:网络整理
导读:我目前正在解决与Exchange Web服务相关的问题.问题是,在打开与流式订阅的连接(通过StreamingSubscriptionConnection对象)时,操作在调用Open方法时挂起.以下是挂起的代码,供参考: _streamingSubscriptionConnection = new StreamingSubscriptionConnection(_
我目前正在解决与Exchange Web服务相关的问题.问题是,在打开与流式订阅的连接(通过StreamingSubscriptionConnection对象)时,操作在调用Open方法时挂起.以下是挂起的代码,供参考:

_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();

它通常需要大约两分钟,然后抛出一个ServiceRequestException,其消息是:

The request has failed. The operation has timed out.

值得一提的是,即使我将超时设置为一分钟,它仍然需要超过一分钟然后抛出此异常.该呼叫永远不会超过该Open命令.

我的问题是,过去有没有人遇到过这个问题?此外,是否有任何可用的工具可用于诊断任何连接问题,以确定异常是在我的端,Exchange服务器端,还是中间的某个地方?我已经尝试过Fiddler和Microsoft网络监视器来寻找任何模式,但我很难辨别任何东西.

提前致谢!

编辑:要添加到此,如果我添加跟踪侦听器,我会得到相当多的输出.我可以看到它检索订阅ID,然后尝试连接.当它发出连接请求时,这是在发出Open命令和超时之间记录的内容:

<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>

我试图排除网络问题,但是有点困难.此时欢迎任何建议.

解决方法

对于那些追随我的人来说,这个问题与.Net或EWS库无关.

问题最终与我们公司负载均衡器的持久性设置有关.使用我们的负载平衡器,如果为EWS流订阅调用启用了任何类型的持久性,那么这些连接将失败.不幸的是,当时我不知道自己和Exchange服务器之间存在负载均衡器,因为开发人员无法访问该基础结构.

无论如何,希望这有助于将来的某个人!

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读