none
"AutodiscoverLocalException" - "The Autodiscover service couldn't be located" while using EWS Managed API 2.2 RRS feed

  • Question

  • Hi everybody,

    I am using EWS Managed API 2.2 to get Autodiscover settings. But it is giving me 'Microsoft.Exchange.WebServices.Data.AutodiscoverLocalException'. The message is "The Autodiscover service couldn't be located." The stack trace is:

       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)
       at Microsoft.Exchange.WebServices.Data.ExchangeService.AutodiscoverUrl(String emailAddress)
       at ConsoleApplication1.Program.Main(String[] args) in c:\Users\pse\Documents\Visual Studio 2013\Projects\ConsoleApplication1\ConsoleApplication1\Program.cs:line 92
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()

    The code that I am using is:

    static void Main(string[] args)
            {
                ExchangeService exchangeService = new ExchangeService(ExchangeVersion.Exchange2013_SP1);
                exchangeService.Credentials = new NetworkCredential("mailboxName", "Password", "domainName");
                exchangeService.TraceEnabled = true;
                exchangeService.TraceFlags = TraceFlags.All;
                exchangeService.AutodiscoverUrl("mailboxName@domainName");
            }

    I am using Exchange Server 2013 with Cumulative Update 7. Kindly help me.

    Thanks & regards,

    Talib Hussain


    • Edited by talib2608 Wednesday, March 11, 2015 7:07 AM
    Wednesday, March 11, 2015 7:05 AM

All replies

  • Hi,

    is your Exchange 2013 on premise ? If so, try adding  :

    exchangeService.EnableScpLookup = true;

    Regards,


    Désiré GOVIN Refresh IT Solutions

    Wednesday, March 11, 2015 10:24 AM
  • Hi Désiré,

    I am using Exchange on premises. I am using Exchange Server 2013 with Cumulative Update 7 as stated in previous post. I have tried your suggestion, still I am getting the same exception.

    Wednesday, March 11, 2015 11:11 AM
  • Since you're tracing, please post your trace. Nine times out of ten this is an authentication issue. However, in your case, it might be a redirection issue, since you're not using the version of AutodiscoverUrl that takes a redirect callback.

    Wednesday, March 11, 2015 3:58 PM
    Moderator
  • Hi Jason,

    Here is the link to the Autodiscover trace that I have uploaded in OneDrive: Autodiscover Trace - OneDrive.

    More information: There are two Exchange Server 2013 with Cumulative Update 7. If we connect to any of those Exchange Servers, then also it will work - correct me if I am wrong.


    • Edited by talib2608 Wednesday, March 18, 2015 9:02 AM
    Thursday, March 12, 2015 5:47 AM