Muokkaa

Jaa


Handling notification-related errors in EWS in Exchange

Find out how to handle notification-related errors in applications that you develop by using the EWS Managed API or EWS in Exchange.

If your application subscribes to and gets notifications, you might have to handle notification-related errors. You can handle these errors at runtime, or while you are developing your EWS application.

Table 1. Notification-related errors and how to handle them

Error Occurs when you try to… Handle it by…
ErrorExceededConnectionCount Open a connection to get events when the account reached its connection limit of open streaming connections.
  • Using impersonation to open connections.
  • Using fewer connections to get events. Maximize the number of subscriptions in each connection by using affinity and placing a maximum of 200 subscription IDs in the same group. You can then use the same connection to retrieve events for the entire group, reducing the number of connections required.
  • Changing the value of the HangingConnectionLimit in the web.config file for Exchange on-premises to override the default value of three open connections. Exchange Online has a default HangingConnectionLimit of 10, which is not configurable.
ErrorExceededSubscriptionCount Create too many subscriptions. The EwsMaxSubscriptions throttling policy parameter determines the maximum number of subscriptions that an account can create.
ErrorInvalidSubscriptionRequest Create subscriptions for multiple mailboxes or multiple folders from a single request. Creating a subscription for a single public folder or a single mailbox in a single request.
ErrorInvalidWatermark Get events by using an invalid watermark.
  • Checking the subscription ID returned in a previous response.
  • Ensuring that you're sending the subscription ID for the correct ExchangeService object.
  • Creating a new subscription.
ErrorMissedNotificationEvents Get events when some previous events were missed. Comparing the extended folder properties PR_LOCAL_COMMIT_TIME_MAX (0x670a) and PR_DELETED_COUNT_TOTAL (0x670b) to determine what changes were missed, and creating a new subscription.
ErrorProxyRequestNotAllowed Subscribe to events for a user in a batched request whose mailbox has moved to another site. Using Autodiscover to rediscover the ExternalEwsUrl or EwsPartnerUrl, and creating a new subscription.
ErrorReadEventsFailed Get events from a subscription that cannot be found. Using Autodiscover to rediscover the ExternalEwsUrl or EwsPartnerUrl, and creating a new subscription.
ErrorServerBusy Exceed throttling limits. Be aware of the following regarding throttling:
  • The EwsMaxSubscriptions throttling limit identifies the maximum number of push, pull, or streaming notification subscriptions that can be active at one time. This is the value of mailbox subscriptions, not the number of individual folder subscriptions in a mailbox subscription. Starting with service mailbox versions 14.16.0135 and 14.15.0057.000, a mailbox hosted by Exchange Online or Exchange Online as part of Office 365 can have up to 20 subscriptions, and a target Exchange 2013 on-premises mailbox can have up to 5000 subscriptions.
  • The EwsMaxConcurrency throttling limit identifies the maximum number of active requests for non-streaming connections and has a default value of 27.
  • The default limit for open streaming connections is ten.
ErrorSubscriptionNotFound Get events for a subscription that cannot be found. The subscription might have expired, the EWS process might have been restarted, or an invalid subscription was passed in.
  • Verifying that you're using the same subscription ID that was returned in a previous response.
  • Ensuring that you're sending the subscription ID for the correct ExchangeService object.
  • Creating a new subscription.
ServiceLocalException Add a subscription to a new folder while a subscription connection is open on another folder. Changing your subscription to subscribe to all folders in the mailbox, instead of a specific folder.
ServiceResponseException Get events for a subscription that cannot be located in the Exchange store.
  • Verifying that you're using the same subscription ID that was returned in a previous response.
  • Ensuring that you're sending the subscription ID for the correct ExchangeService object.

Recovering from lost subscriptions

When a subscription is lost, or is no longer accessible, it is best to create a new subscription and not include the old watermark in the new subscription. Resubscribing with the old watermark causes a linear scan for events, which is costly. Instead, create a new subscription and compare folder properties to look for content changes that occurred between the lost subscription and the new subscription. The extended folder properties that we recommend that you check are PR_LOCAL_COMMIT_TIME_MAX (0x670a0040) and PR_DELETED_COUNT_TOTAL (0x670b0003). You can do this by creating an extended property definition.

See also