.net StreamingSubscriptionConnection。打开一个O365邮箱的挂起
我们正在使用流事件从Office 365中不同用户的EWS获取通知 为此,我们制作了一个订阅管理器来管理到不同服务器的连接。打开订阅的调用如下所示:.net StreamingSubscriptionConnection。打开一个O365邮箱的挂起,.net,exchangewebservices,.net,Exchangewebservices,我们正在使用流事件从Office 365中不同用户的EWS获取通知 为此,我们制作了一个订阅管理器来管理到不同服务器的连接。打开订阅的调用如下所示: _Connection = new StreamingSubscriptionConnection(_Service, 30); // Add connections to the queue foreach (var subscription in pendingSubscribes) { _Connection.AddSubscript
_Connection = new StreamingSubscriptionConnection(_Service, 30);
// Add connections to the queue
foreach (var subscription in pendingSubscribes)
{
_Connection.AddSubscription(subscription);
}
if (_Subscriptions.Count > 0) _Connection.Open();
这就像一个符咒,但现在,代码不会在某个O365邮箱的Open
调用上恢复。所有其他测试邮箱都正常工作
该流已正确注册:
** EwsRequestHttpHeaders **
<Trace Tag="EwsRequestHttpHeaders" Tid="19" Time="2017-05-22 15:26:28Z">
POST /EWS/Exchange.asmx HTTP/1.1
Content-Type: text/xml; charset=utf-8
Accept: text/xml
User-Agent: ExchangeServicesClient/15.00.0913.015
Accept-Encoding: gzip,deflate
X-AnchorMailbox: mail@contoso.onmicrosoft.com
X-PreferServerAffinity: True
</Trace>
** EwsRequest **
<Trace Tag="EwsRequest" Tid="19" Time="2017-05-22 15:26:28Z" Version="15.00.0913.015">
<?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="Exchange2013" />
<t:ExchangeImpersonation>
<t:ConnectingSID>
<t:SmtpAddress>mail@contoso.onmicrosoft.com</t:SmtpAddress>
</t:ConnectingSID>
</t:ExchangeImpersonation>
</soap:Header>
<soap:Body>
<m:Subscribe>
<m:StreamingSubscriptionRequest>
<t:FolderIds>
<t:DistinguishedFolderId Id="calendar">
<t:Mailbox>
<t:EmailAddress>mail@contoso.onmicrosoft.com</t:EmailAddress>
</t:Mailbox>
</t:DistinguishedFolderId>
</t:FolderIds>
<t:EventTypes>
<t:EventType>CreatedEvent</t:EventType>
<t:EventType>ModifiedEvent</t:EventType>
<t:EventType>DeletedEvent</t:EventType>
</t:EventTypes>
</m:StreamingSubscriptionRequest>
</m:Subscribe>
</soap:Body>
</soap:Envelope>
</Trace>
** EwsResponseHttpHeaders **
<Trace Tag="EwsResponseHttpHeaders" Tid="19" Time="2017-05-22 15:26:29Z">
HTTP/1.1 200 OK
Transfer-Encoding: chunked
Content-Encoding: gzip
Vary: Accept-Encoding
request-id: 6f3920a2-9fb3-4717-b966-2861eef559a4
X-CalculatedBETarget: DB5PR02MB1191.eurprd02.prod.outlook.com
X-BackEndHttpStatus: 200
X-FromBackend-ServerAffinity: True
x-EwsHandler: Subscribe
X-DiagInfo: DB5PR02MB1191
X-BEServer: DB5PR02MB1191
Cache-Control: private
Content-Type: text/xml; charset=utf-8
Set-Cookie: exchangecookie=4a58...bf16; expires=Tue, 22-May-2018 15:26:28 GMT; path=/; HttpOnly,X-BackEndOverrideCookie=DB5PR02MB1191.eurprd02.prod.outlook.com~1942062157; path=/; secure; HttpOnly
Server: Microsoft-IIS/8.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
X-FEServer: DB6PR0601CA0013
Date: Mon, 22 May 2017 15:26:29 GMT
</Trace>
** EwsResponse **
<Trace Tag="EwsResponse" Tid="19" Time="2017-05-22 15:26:29Z" Version="15.00.0913.015">
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<h:ServerVersionInfo MajorVersion="15" MinorVersion="1" MajorBuildNumber="1101" MinorBuildNumber="19" Version="V2017_04_14" xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />
</s:Header>
<s:Body>
<m:SubscribeResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<m:ResponseMessages>
<m:SubscribeResponseMessage ResponseClass="Success">
<m:ResponseCode>NoError</m:ResponseCode>
<m:SubscriptionId>JwBk...iMM=</m:SubscriptionId>
</m:SubscribeResponseMessage>
</m:ResponseMessages>
</m:SubscribeResponse>
</s:Body>
</s:Envelope>
</Trace>
**EwsRequestHttpHeaders**
POST/EWS/Exchange.asmx HTTP/1.1
内容类型:text/xml;字符集=utf-8
接受:text/xml
用户代理:ExchangeServicesClient/15.00.0913.015
接受编码:gzip,deflate
X-AnchorMailbox:mail@contoso.onmicrosoft.com
X-PreferServerAffinity:True
**EWS请求**
mail@contoso.onmicrosoft.com
mail@contoso.onmicrosoft.com
CreatedEvent
修饰剂
删除剂
**EwsResponseHttpHeaders**
HTTP/1.1200ok
传输编码:分块
内容编码:gzip
改变:接受编码
请求id:6f3920a2-9fb3-4717-b966-2861eef559a4
X-CalculatedBETarget:DB5PR02MB1191.eurprd02.prod.outlook.com
X-BackEndHttpStatus:200
X-FromBackend-ServerAffinity:True
x-EWSHADLER:订阅
X-DiagInfo:DB5PR02MB1191
X-BEServer:DB5PR02MB1191
缓存控制:专用
内容类型:text/xml;字符集=utf-8
设置Cookie:exchangecookie=4a58…bf16;expires=2018年5月22日星期二15:26:28 GMT;路径=/;HttpOnly,X-BackEndOverrideCookie=DB5PR02MB1191.eurprd02.prod.outlook.com~1942062157;路径=/;保护HttpOnly
服务器:Microsoft IIS/8.5
X-AspNet-Version:4.0.30319
X-Powered-By:ASP.NET
X-FEServer:DB6PR0601CA0013
日期:2017年5月22日星期一15:26:29 GMT
**应急响应**
无误
JwBk…iMM=
然后我们打开StreamingConnection。以下是它查找工作邮箱的方式:
** EwsRequestHttpHeaders **
<Trace Tag="EwsRequestHttpHeaders" Tid="19" Time="2017-05-22 15:28:20Z">
POST /EWS/Exchange.asmx HTTP/1.1
Content-Type: text/xml; charset=utf-8
Accept: text/xml
User-Agent: ExchangeServicesClient/15.00.0913.015
Accept-Encoding: gzip,deflate
X-AnchorMailbox: mail@contoso.onmicrosoft.com
X-PreferServerAffinity: True
X-BackEndOverrideCookie:
</Trace>
** EwsRequest **
<Trace Tag="EwsRequest" Tid="19" Time="2017-05-22 15:28:20Z" Version="15.00.0913.015">
<?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="Exchange2013" />
<t:ExchangeImpersonation>
<t:ConnectingSID>
<t:SmtpAddress>mail@contoso.onmicrosoft.com</t:SmtpAddress>
</t:ConnectingSID>
</t:ExchangeImpersonation>
</soap:Header>
<soap:Body>
<m:GetStreamingEvents>
<m:SubscriptionIds>
<t:SubscriptionId>JwBk...iMM=</t:SubscriptionId>
</m:SubscriptionIds>
<m:ConnectionTimeout>30</m:ConnectionTimeout>
</m:GetStreamingEvents>
</soap:Body>
</soap:Envelope>
</Trace>
** EwsResponseHttpHeaders **
<Trace Tag="EwsResponseHttpHeaders" Tid="19" Time="2017-05-22 15:28:21Z">
HTTP/1.1 200 OK
Transfer-Encoding: chunked
request-id: 25bb05d0-7619-419d-833b-e0b7f3b539c5
X-CalculatedBETarget: DB5PR02MB1191.eurprd02.prod.outlook.com
X-BackEndHttpStatus: 200
X-NoBuffering: 1
X-DiagInfo: DB5PR02MB1191
X-BEServer: DB5PR02MB1191
X-FEServer: HE1P195CA0011
Cache-Control: private
Date: Mon, 22 May 2017 15:28:20 GMT
Set-Cookie: exchangecookie=4a58...bf16; path=/
Server: Microsoft-IIS/8.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
</Trace>
**EwsRequestHttpHeaders**
POST/EWS/Exchange.asmx HTTP/1.1
内容类型:text/xml;字符集=utf-8
接受:text/xml
用户代理:ExchangeServicesClient/15.00.0913.015
接受编码:gzip,deflate
X-AnchorMailbox:mail@contoso.onmicrosoft.com
X-PreferServerAffinity:True
X-BackEndOverrideCookie:
**EWS请求**
mail@contoso.onmicrosoft.com
JwBk…iMM=
30
**EwsResponseHttpHeaders**
HTTP/1.1200ok
传输编码:分块
请求id:25bb05d0-7619-419d-833b-e0b7f3b539c5
X-CalculatedBETarget:DB5PR02MB1191.eurprd02.prod.outlook.com
X-BackEndHttpStatus:200
X-NoBuffering:1
X-DiagInfo:DB5PR02MB1191
X-BEServer:DB5PR02MB1191
X-FEServer:HE1P195CA0011
缓存控制:专用
日期:2017年5月22日星期一15:28:20 GMT
设置Cookie:exchangecookie=4a58…bf16;路径=/
服务器:Microsoft IIS/8.5
X-AspNet-Version:4.0.30319
X-Powered-By:ASP.NET
响应主体不会立即返回,因为连接保持打开状态
但是,对于不工作的邮箱,响应Http头根本不会返回
什么会导致这个问题?API不应该返回有效数据或错误消息吗?您可能只是遇到了并发连接问题(这是最常见的错误),例如,如果您没有设置,则无法打开超过2个连接。我建议的另一件事是,您可以使用ewsdeditor@GlenScales测试该邮箱。您知道单个Office 365租户可以参与的Exchange服务器的最大数量吗?或者我可以安全地将ConnectionLimit设置为30k吗?如果您使用模拟,那么您不应该遇到并发问题