locked
Exchange EWS Managed Api Streaming Connection Error: ErrorNoApplicableProxyCASServersAvailable - Exchange Web Services are not currently available for this request because there are no available Client Access Services Servers in the target AD Site. RRS feed

  • Question

  • Hello,

    I'm using EWS Managed Api 2 to develop client mail application. For sync operation, I tried to use streaming notification technique however, an error occured when I tried to open connection. Error is that ErrorNoApplicableProxyCASServersAvailable - Exchange Web Services are not currently available for this request because there are no available Client Access Services Servers in the target AD Site.

    I could not find any solution to solve this issue. Coding part can be seen below. Could you help about my problem?

    var service = new ExchangeService(ExchangeVersion.Exchange2010_SP2, TimeZoneInfo.FindSystemTimeZoneById("UTC"));

    service.Credentials = new WebCredentials(Username, MailPassword, Domain);
     
    service.TraceEnabled = false;
    service.Url = new Uri(ExchangeURL);

    StreamingSubscription ss = _exchangeMail.service.SubscribeToStreamingNotifications(                                              new FolderId[] { WellKnownFolderName.Inbox },

                                                  EventType.NewMail,
                                                  EventType.Created,
                                                  EventType.Deleted,
                                                  EventType.Modified,
                                                  EventType.Moved,
                                                  EventType.Copied,
                                                  EventType.FreeBusyChanged);
                          StreamingSubscriptionConnection connection = new StreamingSubscriptionConnection(_exchangeMail.service,new StreamingSubscription[] { ss }, 30);
                          //connection.AddSubscription(ss);
                          connection.OnSubscriptionError += OnSubscriptionError;
                          connection.OnNotificationEvent += OnNotificationEvent;
                          connection.OnDisconnect += OnDisconnect;
                          connection.Open();

    Thursday, May 12, 2016 12:07 PM

All replies

  • Thansk for your reply. I added headers after the service.Url=.... part like below.

    service.HttpHeaders.Add("X-AnchorMailbox""aa@nn.com");
    service.HttpHeaders.Add("X-PreferServerAffinity""true");

    However,  Errors are continue. I have different exchange servers to test this issue. Some of them are working fine. Headers does not have any effect for these working accounts. They works for both cases  and connection is opened without the error. 

    Also, for all exchange account test, I do not have any problem to connect exchange like Folder.Bind or I can take sync states when checking periodically. However, when I try to open connection for streaming, I take the related error.

    I wonder it, how outlook or mobile mail clients are working without problem. I am not sure they are using streaming or periodically checking mechanism but I think that, they are using also, a push mechanism to take emails.



    Friday, May 13, 2016 7:45 AM
  • The place to start with is the error message eg "Exchange Web Services are not currently available for this request because there are no available Client Access Services Servers in the target AD Site"

    So the error message is telling you when the request is trying to be proxied to the AD site where the Mailbox is currently located that it can't contact a CAS in that site. So if you want to trace it though have a look at the EWS logs on the servers that are being reporting in the cookies you will get back from the request. As the link I posted explains there is a difference in the way routing works depending on the version of Exchange that is being run, if your running HA that can be consideration when Mailboxes are failed over it does take time of the environment to be fully updated on where all the Mailboxes are not located etc (eg if you have no problem in single site environments but problems in multi site). But I would start tracing with the EWS Log file on the CAS servers.

    Cheers
    Glen


    Monday, May 16, 2016 5:33 AM
  • thanks for your reply. I will check the ews configuration and logs.
    Monday, May 16, 2016 9:28 AM