none
[Exchange-Online][EWSMA][C#][Windows]: Assistance with AutodiscoverLocalException Error RRS feed

  • Question

  • To start off I have spent the last two hours looking through the older posts to find the answer to this one, so I apologize if I've overlooked it.

    I developed a Middleware Web Service that our ticketing system can call to put appointments on our Live@EDU (Exchange Online) calendars.  I developed this in Visual Studio 2010 on Windows 7 behind a proxy service.  It worked great on that platform when I deployed it to the localhost.

    I've now since deployed it on our development application server (Windows 2008 R2, IIS 7) which is also running through the same proxy service, and I'm getting this error when running my web service method:

    Microsoft.Exchange.WebServices.Data.AutodiscoverLocalException: The Autodiscover service couldn't be located.
       at Microsoft.Exchange.WebServices.Autodiscover.AutodiscoverService.InternalGetLegacyUserSettings[TSettings](String emailAddress, List`1 redirectionEmailAddresses, Int32& currentHop)
       at Microsoft.Exchange.WebServices.Autodiscover.AutodiscoverService.GetLegacyUserSettings[TSettings](String emailAddress)
       at Microsoft.Exchange.WebServices.Autodiscover.AutodiscoverService.InternalGetLegacyUserSettings(String emailAddress, List`1 requestedSettings)
       at Microsoft.Exchange.WebServices.Autodiscover.AutodiscoverService.GetUserSettings(String userSmtpAddress, UserSettingName[] userSettingNames)
       at Microsoft.Exchange.WebServices.Data.ExchangeService.GetAutodiscoverUrl(String emailAddress, ExchangeVersion requestedServerVersion, AutodiscoverRedirectionUrlValidationCallback validateRedirectionUrlCallback)
       at Microsoft.Exchange.WebServices.Data.ExchangeService.AutodiscoverUrl(String emailAddress, AutodiscoverRedirectionUrlValidationCallback validateRedirectionUrlCallback)

    I can run the test for Web Services on 'http://testexchangeconnectivity.com' without a problem.  Any idea what might be occurring?  This server is a lot more locked down than my desktop where I developed it initially, and I have a feeling it's firewall (local or edge) related, but I'm not sure.

    My next step is to run a WireShark trace and see what is happening, but I was hoping someone else might have run into this situation before as well.


    Wednesday, August 22, 2012 7:57 PM

Answers

  • So I finally figured out what was occurring.  I needed to make a change to the web.config file with the following snippet:

    <system.net>

        <defaultProxy>
          <proxy
          usesystemdefault="true"
          bypassonlocal="true"
          proxyaddress="<redacted name of our proxy server"
    />
        </defaultProxy>
     </system.net>

    Thanks!


    Rachel Moorehead - University of Georgia

    Monday, September 24, 2012 8:56 PM

All replies

  • -> can you call the exchange.asmx (http://FQDN/EWS/Exchange.asmx) using IE without any problem?
    -> You can download latest EWSEditor utility (http://ewseditor.codeplex.com/) and see whether you can repro the issue or not. It will also have the ability to capture the EWS response/request.
    -> Check any NLB plays any role here.


    DeVa, M.S., {MSFT} Please remember to mark the replies as answers if they help

    Wednesday, August 22, 2012 8:59 PM
  • Thank you for your response.

    - I am able to call the Exchange.asmx using IE without any problems.

    - I am able to successfully use the EWSEditor and all the Trace Logs appear as I would expect.

    - By NLB, do you mean network load balancing?  Exchange Online is load balanced.  The server I'm running the app from is not.  It does have a non-trace IP, but I'm not sure if that's the problem here or not, since everything (not my app) through IE and now EWSEditor works fine.  Is there any way to get the level of logging in the EWSEditor while trying to run a method in my Web Service?


    Rachel Moorehead - University of Georgia

    Thursday, August 23, 2012 7:05 PM
  • If it work with you EWS Editor(it uses EWS Managed API), then I would have a look at the code & check the proxy reference (if you use Proxy classes). I don't think you have a way from EWSEditor and collect log for custom app. But, if you use EWS Managed API, then you can use Trace listener for logging/debugging purpose:  http://msdn.microsoft.com/en-us/library/exchange/dd633676(v=exchg.80).aspx. Also you can have a look at http://msdn.microsoft.com/en-us/library/gg194011%28v=exchg.140%29.aspx talks about Exchange online & auto discover service.


    DeVa, M.S., {MSFT} Please remember to mark the replies as answers if they help

    Thursday, August 23, 2012 7:29 PM
  • See that's the thing.  I know my code works because I can deploy it locally and it connected without any issues.  It's only after I've deployed it to this new dev server that it no longer is able to connect.

    I'll try implementing the trace listener to see if it gives me any more valuable information, but I think the real issue lies somewhere in the change between environments.


    Rachel Moorehead - University of Georgia

    Thursday, August 23, 2012 7:36 PM
  • Good Morning,

    So I've been trying to get tracing to work, but every time I deploy it, the request times out (it's set to 4 minutes right now).  I'm testing this all locally first.  If I take out the tracing statements, it works again.  Any ideas?

    I'm following the instructions that you posted earlier:

    http://msdn.microsoft.com/en-us/library/exchange/dd633676(v=exchg.80).aspx

    However, when I get to this line, it's incorrect:

    service.TraceListener = ITraceListenerInstance;

    and I have to use:

    service.TraceListener = new TraceListener();

    Any ideas?  Are there any better tutorials out their for tracing EWS statements?

    Thanks.


    Rachel Moorehead - University of Georgia

    Tuesday, August 28, 2012 3:26 PM
  • So I finally figured out what was occurring.  I needed to make a change to the web.config file with the following snippet:

    <system.net>

        <defaultProxy>
          <proxy
          usesystemdefault="true"
          bypassonlocal="true"
          proxyaddress="<redacted name of our proxy server"
    />
        </defaultProxy>
     </system.net>

    Thanks!


    Rachel Moorehead - University of Georgia

    Monday, September 24, 2012 8:56 PM
  • We  have same issue when using AutodiscoverUrl. In my scenario, we have to read multiple mailboxes and in a loop we are calling service.AutodiscoverUrl for each mailbox. When we call for one mailbox no issue (perfect) and when we include multiple mailboxes then we get this error.

    The Autodiscover service couldn't be located. at Microsoft.Exchange.WebServices.Autodiscover.AutodiscoverService.InternalGetLegacyUserSettings[TSettings]
    (String emailAddress, List`1 redirectionEmailAddresses, Int32& currentHop) at
    Microsoft.Exchange.WebServices.Autodiscover.AutodiscoverService.InternalGetLegacyUserSettings[TSettings](String emailAddress, List`1 .....

    Let me know if you have any ideas?

    Thank You.


    • Edited by ArkaySPS Friday, July 26, 2013 11:32 AM 1234
    Friday, July 26, 2013 11:31 AM