Exchange Webservice AutoDiscover service couldnt be located

0

I have this code

ExchangeService serviceInstance;
            serviceInstance = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
            serviceInstance.Credentials = new WebCredentials("Jacob.Alley", "*****", "emaildomain");
            serviceInstance.TraceEnabled = true;
            serviceInstance.AutodiscoverUrl("Jacob.Alley@emaildomain.com");

and I get the "AutoDiscover service couldnt be located" error thrown. Here is the trace

`

Trying to call Autodiscover for Jacob.Alley@emaildomain.com on https://emaildomain.com/autodiscover/autodiscover.xml.
</Trace>
<Trace Tag="AutodiscoverRequestHttpHeaders" Tid="8" Time="2016-11-16 18:41:58Z"

POST /autodiscover/autodiscover.xml HTTP/1.1
Content-Type: text/xml; charset=utf-8
Accept: text/xml
User-Agent: ExchangeServicesClient/15.00.0847.030


</Trace>
<Trace Tag="AutodiscoverRequest" Tid="8" Time="2016-11-16 18:41:58Z" Version="1
.00.0847.030">
  <Autodiscover xmlns="http://schemas.microsoft.com/exchange/autodiscover/outlo
k/requestschema/2006">
    <Request>
      <EMailAddress>Jacob.Alley@emaildomain.com</EMailAddress>
      <AcceptableResponseSchema>http://schemas.microsoft.com/exchange/autodisco
er/outlook/responseschema/2006a</AcceptableResponseSchema>
    </Request>
  </Autodiscover>
</Trace>
<Trace Tag="AutodiscoverConfiguration" Tid="8" Time="2016-11-16 18:41:58Z">
 failed: WebException (The underlying connection was closed: Could not establis
 trust relationship for the SSL/TLS secure channel.)
</Trace>
<Trace Tag="AutodiscoverConfiguration" Tid="8" Time="2016-11-16 18:41:58Z">
Trying to call Autodiscover for Jacob.Alley@emaildomain.com on https://autodisc
ver.emaildomain.com/autodiscover/autodiscover.xml.
</Trace>
<Trace Tag="AutodiscoverRequestHttpHeaders" Tid="8" Time="2016-11-16 18:41:58Z"

POST /autodiscover/autodiscover.xml HTTP/1.1
Content-Type: text/xml; charset=utf-8
Accept: text/xml
User-Agent: ExchangeServicesClient/15.00.0847.030


</Trace>
<Trace Tag="AutodiscoverConfiguration" Tid="8" Time="2016-11-16 18:41:58Z">
 failed: WebException (The remote name could not be resolved: 'autodiscover.emaildomain.com')
</Trace>
<Trace Tag="AutodiscoverConfiguration" Tid="8" Time="2016-11-16 18:41:58Z">
Trying to get Autodiscover redirection URL from http://autodiscover.emaildomain.com/autodiscover/autodiscover.xml.
</Trace>
<Trace Tag="AutodiscoverConfiguration" Tid="8" Time="2016-11-16 18:41:58Z">
Request error: The remote name could not be resolved: 'autodiscover.emaildomain
com'
</Trace>
<Trace Tag="AutodiscoverConfiguration" Tid="8" Time="2016-11-16 18:41:58Z">
No Autodiscover redirection URL was returned.
</Trace>
<Trace Tag="AutodiscoverConfiguration" Tid="8" Time="2016-11-16 18:41:58Z">
Trying to get Autodiscover host from DNS SRV record for emaildomain.com.
</Trace>
<Trace Tag="AutodiscoverConfiguration" Tid="8" Time="2016-11-16 18:41:58Z">
DnsQuery returned error error 'DNS name does not exist' error code 0x0000232B.
</Trace>
<Trace Tag="AutodiscoverConfiguration" Tid="8" Time="2016-11-16 18:41:58Z">
No appropriate SRV record was found.
</Trace>
<Trace Tag="AutodiscoverConfiguration" Tid="8" Time="2016-11-16 18:41:58Z">
No matching Autodiscover DNS SRV records were found.
</Trace>`

I know that i have the correct email address/username/password, but im not really sure how to decipher the trace, or if there is somethign that I am doing wrong.

c#
visual-studio
email
exchange-server
exchangewebservices
asked on Stack Overflow Nov 16, 2016 by Jacob Alley

1 Answer

0

If you look at the trace it appears that none of the DNS records are configured for Autodiscover eg "The remote name could not be resolved"

The SCP lookup of Active Directory was successful but the URL its trying to use doesn't match the SSL Certificate on the Web-server "(The underlying connection was closed: Could not establis trust relationship for the SSL/TLS secure channel". If this is just a development server you can ignore that error by using a SSL bypass like

System.Net.ServicePointManager.ServerCertificateValidationCallback +=
(se, cert, chain, sslerror) =>
    {
        return true;
    };

You can test Autodiscover externally using https://testconnectivity.microsoft.com/

answered on Stack Overflow Nov 17, 2016 by Glen Scales

User contributions licensed under CC BY-SA 3.0