After our company upgraded from Exchange 2010 to Exchange 2013, I found a really strange quirk. I use the EWS-managed API to create a streaming subscription to some public folders. I have some more old Windows services that happily subscribe, read new mail, etc. I have my new project that will eventually replace these old Windows services, and although we were on Exchange 2010, it could create the same streaming subscriptions to the same shared folders, and legacy Windows services were still running. After updating, now I get a ServerBusyException when trying to open StreamingSubscriptionConnection. If I turn off all legacy Windows services, I can open the connection in my new project.
Here's how I sign up, nothing out of the ordinary:
private StreamingSubscriptionConnection CreateStreamingSubscription(ExchangeService service, StreamingSubscription subscription)
{
var connection = new StreamingSubscriptionConnection(service, 30);
connection.AddSubscription(subscription);
connection.OnNotificationEvent += connection_OnNotificationEvent;
connection.OnSubscriptionError += connection_OnSubscriptionError;
connection.OnDisconnect += connection_OnDisconnect;
try
{
connection.Open();
}
catch (ServerBusyException ex)
{
Log.Error("Connection to Exchange refused. Server is too busy.", ex);
throw;
}
catch (Exception ex)
{
Log.Error("Unknown error connection to Exchange.", ex);
throw;
}
return connection;
}
After viewing this MSDN, the BackOffMilliseconds property exists, but it returns as 0, which indicates that Exchange is not actually telling me to try again later. I registered with the Exchange server to check the throttling policy, and the default global policy is applied. Each parameter that has the word "concurrency" in it is more than 10, so I don't think this is a throttling policy issue. For what it's worth, my legacy Windows services and this new project use the same service account to complete their task.
I also looked at how the connection to the service is made, and there is no change whether it will be installed on Exchange2013 or Exchange2010_SP1:
private ExchangeService CreateExchangeService()
{
ServicePointManager.ServerCertificateValidationCallback = CertificateValidationCallBack;
var service = new ExchangeService(ExchangeVersion.Exchange2013);
service.Credentials = new WebCredentials(ExchangeUser, ExchangePassword, ExchangeDomain);
service.AutodiscoverUrl(ExchangeEmail, RedirectionUrlValidationCallback);
return service;
}
Fiddler, , , HTTP 500 , , .
, API EWS Exchange 2013 vs 2010SP2?