title: Exchange Impersonation in Service Account: Autodiscover service couldn't be located
body: <p>Sending a simple email through ews is working as intended - from my account to my account:</p>
  
  <pre><code>ExchangeService ews = new ExchangeService(ExchangeVersion.Exchange2010);
  ews.AutodiscoverUrl("myname@mydomain.com");
  EmailMessage email = new EmailMessage(ews);
  email.ToRecipients.Add("myname@mydomain.com");
  email.Subject = "HelloWorld";
  email.Body = new MessageBody("This is the first email I've sent by using the EWS Managed API");
  email.Send();
  </code></pre>
  
  <p>Simply trying impersonation, it is also working as intended - in the last line, it returns the error that I am not allowed to impersonate:</p>
  
  <pre><code>ExchangeService ews = new ExchangeService(ExchangeVersion.Exchange2010);
  ews.AutodiscoverUrl("myname@mydomain.com");
  ews.ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.SmtpAddress, "testuser@mydomain.com");
  EmailMessage email = new EmailMessage(ews);
  email.ToRecipients.Add("myname@mydomain.com");
  email.Subject = "HelloWorld";
  email.Body = new MessageBody("This is the first email I've sent by using the EWS Managed API");
  email.Send();
  </code></pre>
  
  <p>Now I try to login with my application service account instead:</p>
  
  <pre><code>ExchangeService ews = new ExchangeService(ExchangeVersion.Exchange2010);
  ews.Credentials = new NetworkCredential("service", "1234", "mydomain.com");
  //ews.Credentials = new WebCredentials("service", "1234");
  ews.AutodiscoverUrl("myname@mydomain.com");
  //ews.AutodiscoverUrl("service@mydomain.com");
  ews.ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.SmtpAddress, "testuser@mydomain.com");
  EmailMessage email = new EmailMessage(ews);
  email.ToRecipients.Add("myname@mydomain.com");
  email.Subject = "HelloWorld";
  email.Body = new MessageBody("This is the first email I've sent by using the EWS Managed API");
  email.Send();
  </code></pre>
  
  <p>But here it throws an error in the autodiscover line: "AutodiscoverLocalException: The Autodiscover service couldn't be located."</p>
  
  <p>The service account is set up in AD and Exchange, with correct password and smtp address.</p>
  
  <p>Why isn't it working? How can I check what's causing that error?</p>