none
[E2010] [EWS-XML] [C#]: AutoDiscover returning 600 - Invalid Request

    Question

  • Hey Guys,
    I Apologise for the long post but I've been banging my head against the wall for something that should be fairly simple.....
    I'm attempting to use the EWS API to use AutoDiscover to get details about the end users CAS server....

    This is all run on VMWare so it definitely could be environmental at the moment, but the topology is as follows
    ad-sql.testDomain.com (192.168.100.1 - Windows Server 2008 R2 x64 in a 2008 R2 functional forest)
    exch1.testDomain.com (192.168.100.2 - Windows Server 2008 R2 x64 and Exchange 2010 SP1, running CAS/HUB/MBX roles)
    exch2.testDomain.com (192.168.100.3 - Windows Server 2008 R2 x64 and Exchange 2010 SP1, running CAS/HUB/MBX roles)
    client.testDomain.com (192.168.100.4 - Windows 7 x64 with Outlook 2007)

    I downloaded the EWS API here: http://www.microsoft.com/en-us/download/details.aspx?id=30141
    I Follow the code examples here: http://msdn.microsoft.com/en-us/library/dd637749(v=exchg.80).aspx

    The code is C# in NET Framework 4.0 and Visual Studio 2010
    My Code looks like the following:

    AutodiscoverService ads = new AutodiscoverService("testDomain.com", ExchangeVersion.Exchange2010_SP1);
    ads.Credentials = new WebCredentials("emailAdmin", "Pa$$w0rd", "testDomain.com");
    ads.Url = new Uri("https://exch1.testDomain.com/AutoDiscover/autodiscover.xml");
    ads.EnableScpLookup = true;
    
    GetUserSettingsResponse userResponse = ads.GetUserSettings("emailAdmin@testDomain.com", UserSettingName.ActiveDirectoryServer, UserSettingName.InternalMailboxServer);
    
    foreach (KeyValuePair<UserSettingName, Object> usersetting in userresponse.Settings)
    {
     Console.WriteLine(usersetting.Key.ToString() + ": " + usersetting.Value);
    }

    The problem I get however is that when the XML Response comes back, i see this in the EWS Trace, which you'd typically see if you open through IE and not pass any XML in the POST....

    <?xml version="1.0" encoding="UTF-8"?>
    < Autodiscover xmlns="http://schemas.microsoft.com/exchange/autodiscover/responseschema/2006">
    <Response>
      <Error Id="2751842875" Time="09:37:52.0917545">
       <ErrorCode>600</ErrorCode>
       <Message>Invalid Request</Message>
       <DebugData/>
      </Error>
    </Response>
    < /Autodiscover>

    However, if i change this line: new AutodiscoverService("testDomain.com", ExchangeVersion.Exchange2010_SP1);
    to be ExchangeVersion.Exchange2007_SP1, it returns without any issue, but i have to the specify the URI, otherwise it just tries to contact https://testDomain.com/AutoDiscover/ which is the domain controller

    If i test autodiscover through Outlook, it works fine, it fines the correct URL and succeeds
    If i run 'Test-OutlookWebServices emailAdmin@testDomain.com' it comes back OK and outputs the following:

    RunspaceId : 89dedb6a-80df-4912-ba1b-d81f4130d86b
    Id         : 1014
    Type       : Information
    Message    : [EXCH] The UM is configured for this user in the Autodiscover response received fromhttps://exch1.testDomain.com/autodiscover/autodiscover.xml.

    RunspaceId : 89dedb6a-80df-4912-ba1b-d81f4130d86b
    Id         : 1022
    Type       : Success
    Message    : Autodiscover was tested successfully.

    I also tried an alternative client someone created called AutoDiscoverChecker here:
    http://code.msdn.microsoft.com/windowsdesktop/Autodiscover-Checker-e1ebca42

    For Exchange2007_SP1 absolutely fine, comes back with no issues
    For Exchange2010_SP1 it returns:

    < Trace Tag="AutodiscoverConfiguration" Tid="1" Time="2012-06-27 13:51:23Z">
    No Autodiscover endpoints are available for host autodiscover.testDomain.com
    < /Trace>

    Error thrown in code:

        Error Message: The Autodiscover service couldn't be located.
        Inner Error Message: The Autodiscover service couldn't be located

    and lastly, i do have autodiscovery CNAME pointing to exch1.enterprise.vault, i have created and exported the SSL certificates from the exchange machines to all the others so theres no SSL issues about not being from a trusted authority.

    And if i run 'Get-ClientAccessServer exch1 | fl' ... i get the following

    [PS] C:\Windows\system32>Get-ClientAccessServer exch1 | fl

    RunspaceId                           : 89dedb6a-80df-4912-ba1b-d81f4130d86b
    Name                                 : EXCH1
    Fqdn                                 : EXCH1.TESTDOMAIN.COM
    OutlookAnywhereEnabled               : False
    AutoDiscoverServiceCN                : exch1
    AutoDiscoverServiceClassName         : ms-Exchange-AutoDiscover-Service
    AutoDiscoverServiceInternalUri       : https://exch1.testDomain.com/autodiscover/autodiscover.xml
    AutoDiscoverServiceGuid              : 77378f46-2c66-4aa9-a6a6-3e7a48b19596

    Any pointers or ideas are very much appreciated as I think i've exhausted almost every option at this point as far as i can tell?

    Cheers


    • Edited by Maquiladoras Wednesday, June 27, 2012 9:46 PM changed to follow forum rules
    Wednesday, June 27, 2012 8:57 PM

Answers

All replies

  • Hi,

    if you just "download" the autodiscover webpage using (Powershell, IE, ...) it is quite normal that you receive Error 600 and this error indicates that there is no problem with the autodiscoverr webserrvice. :-)


    regards Thomas Paetzold visit my blog on: http://sus42.wordpress.com

    Thursday, June 28, 2012 4:26 AM
  • Right yeah i know that, but the issue is that i'm using the API.
    If i specify ExchangeVersion.Exchange2010_SP1 i get 600 - invalid request, if i specify ExchangeVersion.Exchange2007_SP1 it works fine
    Thursday, June 28, 2012 12:24 PM
  • I've never managed to get any Autodiscover code working (it works fine in Outlook, I just can't get any code samples to work), so I can't give you a definitive answer; but I would take a look at the IIS log files and see how the successful requests differ from the failing ones.  If it really is sending a GET, then that would be rather odd.

    Mobile OWA For Smartphone
    www.leederbyshire.com
    email a@t leederbyshire d.0.t c.0.m

    Thursday, June 28, 2012 12:46 PM
  • Here it is, sorry for the insane amount of text

    Using ExchangeVersion.Exchange2007_SP1

    IIS Logs:
    2012-06-28 14:04:15 192.168.100.2 POST /Autodiscover/autodiscover.xml - 443 - 192.168.100.4 ExchangeServicesClient/14.03.0067.001 401 0 0 358
    2012-06-28 14:04:17 192.168.100.2 POST /Autodiscover/autodiscover.xml - 443 TESTDOMAIN\emailAdmin 192.168.100.4 ExchangeServicesClient/14.03.0067.001 200 0 0 1825

    EWS Trace:
    <Trace Tag="AutodiscoverConfiguration" Tid="1" Time="2012-06-28 14:04:17Z">
    Trying to call Autodiscover for emailAdmin@testDomain.com on https://exch1.testDomain.com/Autodiscover/autodiscover.xml.
    </Trace>

    [AutodiscoverConfiguration]
    <Trace Tag="AutodiscoverRequestHttpHeaders" Tid="1" Time="2012-06-28 14:04:17Z">
    POST /Autodiscover/autodiscover.xml HTTP/1.1
    Content-Type: text/xml; charset=utf-8
    Accept: text/xml
    User-Agent: ExchangeServicesClient/14.03.0067.001
    </Trace>

    [AutodiscoverRequestHttpHeaders]
    <Trace Tag="AutodiscoverRequest" Tid="1" Time="2012-06-28 14:04:17Z" Version="14.03.0067.001">
      <Autodiscover xmlns="http://schemas.microsoft.com/exchange/autodiscover/outlook/requestschema/2006">
        <Request>
          <EMailAddress>emailAdmin@testDomain.com</EMailAddress>
          <AcceptableResponseSchema>http://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a</AcceptableResponseSchema>
        </Request>
      </Autodiscover>
    </Trace>

    [AutodiscoverRequest]
    <Trace Tag="AutodiscoverResponseHttpHeaders" Tid="1" Time="2012-06-28 14:04:19Z">
    200 OK
    Persistent-Auth: false
    Content-Length: 2679
    Cache-Control: private
    Content-Type: text/xml; charset=utf-8
    Date: Thu, 28 Jun 2012 14:04:17 GMT
    Server: Microsoft-IIS/7.5
    WWW-Authenticate: Negotiate oYG2MIGzoAMKAQChCwYJKoZIgvcSAQICooGeBIGbYIGYBgkqhkiG9xIBAgICAG+BiDCBhaADAgEFoQMCAQ+ieTB3oAMCARKicARuhFwGuW5duIdTjGY0UKCeMvCStXXJk9Xjo5G4vBJW+QhB+2PuBQrMx7VG8ZY9FEQLPyc1kOebZMTlHUG1lPL86mhoUDfV4euXHAiXxMTorGkzQdI1gfFBbqsrTUEMfwAa8fKio9AjVRDAG9oB4AE=
    X-AspNet-Version: 2.0.50727
    X-Powered-By: ASP.NET
    </Trace>


    Using ExchangeVersion.Exchange2010_SP1

    IIS Logs:
    2012-06-28 14:10:03 192.168.100.2 POST /Autodiscover/autodiscover.xml - 443 TESTDOMAIN\emailAdmin 192.168.100.4 ExchangeServicesClient/14.03.0067.001 200 0 0 0
    2012-06-28 14:10:03 192.168.100.2 POST /Autodiscover/autodiscover.xml - 443 - 192.168.100.4 ExchangeServicesClient/14.03.0067.001 401 0 0 78

    EWS Trace:
    <Trace Tag="AutodiscoverRequestHttpHeaders" Tid="1" Time="2012-06-28 14:10:04Z">
    POST /Autodiscover/autodiscover.xml HTTP/1.1
    Content-Type: text/xml; charset=utf-8
    Accept: text/xml
    User-Agent: ExchangeServicesClient/14.03.0067.001
    </Trace>

    [AutodiscoverRequestHttpHeaders]
    <Trace Tag="AutodiscoverRequest" Tid="1" Time="2012-06-28 14:10:04Z" Version="14.03.0067.001">
      <?xml version="1.0" encoding="utf-8"?>
      <soap:Envelope xmlns:a="http://schemas.microsoft.com/exchange/2010/Autodiscover" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
        <soap:Header>
          <a:RequestedServerVersion>Exchange2010_SP1</a:RequestedServerVersion>
          <wsa:Action>http://schemas.microsoft.com/exchange/2010/Autodiscover/Autodiscover/GetUserSettings</wsa:Action>
          <wsa:To>https://exch1.testDomain.com/Autodiscover/autodiscover.xml</wsa:To>
        </soap:Header>
        <soap:Body>
          <a:GetUserSettingsRequestMessage xmlns:a="http://schemas.microsoft.com/exchange/2010/Autodiscover">
            <a:Request>
              <a:Users>
                <a:User>
                  <a:Mailbox>emailAdmin@testDomain.com</a:Mailbox>
                </a:User>
              </a:Users>
              <a:RequestedSettings>
                <a:Setting>ActiveDirectoryServer</a:Setting>
                <a:Setting>InternalMailboxServer</a:Setting>
              </a:RequestedSettings>
            </a:Request>
          </a:GetUserSettingsRequestMessage>
        </soap:Body>
      </soap:Envelope>
    </Trace>

    [AutodiscoverRequest]
    <Trace Tag="AutodiscoverResponseHttpHeaders" Tid="1" Time="2012-06-28 14:10:04Z">
    200 OK
    Persistent-Auth: false
    Content-Length: 343
    Cache-Control: private
    Content-Type: text/xml; charset=utf-8
    Date: Thu, 28 Jun 2012 14:10:03 GMT
    Server: Microsoft-IIS/7.5
    WWW-Authenticate: Negotiate oYG2MIGzoAMKAQChCwYJKoZIgvcSAQICooGeBIGbYIGYBgkqhkiG9xIBAgICAG+BiDCBhaADAgEFoQMCAQ+ieTB3oAMCARKicARuCzcd0cO0j2eESk7Nj+w3nZfbdQHctWSp1ugRTecwY+PK0v5jUEj2eZULPM/Nt9orVX4d1TO0ifjOPEK4urjXeEejf+ZquHX7T4XXR/L1/3QofWMW+9uxuolX0t0ZDrZ92ilEQZA7HXOiLcYXc/M=
    X-AspNet-Version: 2.0.50727
    X-Powered-By: ASP.NET
    </Trace>

    [AutodiscoverResponseHttpHeaders]
    <Trace Tag="AutodiscoverResponse" Tid="1" Time="2012-06-28 14:10:04Z" Version="14.03.0067.001">
      <?xml version="1.0" encoding="utf-8"?>
      <Autodiscover xmlns="http://schemas.microsoft.com/exchange/autodiscover/responseschema/2006">
        <Response>
          <Error Time="10:10:03.6015917" Id="2751842875">
            <ErrorCode>600</ErrorCode>
            <Message>Invalid Request</Message>
            <DebugData />
          </Error>
        </Response>
      </Autodiscover>
    </Trace>


    Using ExchangeVersion.Exchange2010_SP1 without specifying the URL

    <Trace Tag="AutodiscoverConfiguration" Tid="1" Time="2012-06-28 14:19:09Z">
    Determining which endpoints are enabled for host testDomain.com
    </Trace>

    [AutodiscoverConfiguration]
    <Trace Tag="AutodiscoverConfiguration" Tid="1" Time="2012-06-28 14:19:10Z">
    Host returned enabled endpoint flags: Legacy
    </Trace>

    [AutodiscoverConfiguration]
    <Trace Tag="AutodiscoverConfiguration" Tid="1" Time="2012-06-28 14:19:10Z">
    No Autodiscover endpoints are available for host testDomain.com
    </Trace>

    [AutodiscoverConfiguration]

    Thursday, June 28, 2012 2:25 PM
  • I don't see any IIS log entries showing the 600 response (it would be the fourth number from the end, like the 401 and the 200 in the first two log entries you pasted).  Do you not see them in the same log files as the others?  If not, then the requests are going to the wrong site.

    Mobile OWA For Smartphone
    www.leederbyshire.com
    email a@t leederbyshire d.0.t c.0.m

    Thursday, June 28, 2012 2:31 PM
  • Well no because the response is accepted by IIS so it will be a 200... so I just tried through IE (where the XML will give the 600 Invalid Request response because of no POST) and i see this

    2012-06-28 14:33:04 192.168.100.2 GET /AutoDiscover/AutoDiscover.xml - 443 TESTDOMAIN\emailAdmin 192.168.100.4 Mozilla/5.0+(compatible;+MSIE+9.0;+Windows+NT+6.1;+WOW64;+Trident/5.0) 200 0 0 218

    So you can see that it is a GET request , where as the previous one was a POST request because we are sending the SOAP request along with it

    Thursday, June 28, 2012 2:38 PM
  • Ah, right.  I thought it was an IIS response code, instead it's an autodiscover error code with the same meaning.

    Anyway, the GetUserSettings XML is supposed to look like this (when you use Exchange2010_SP1):

    http://msdn.microsoft.com/en-us/library/dd877096(v=exchg.140).aspx

    I note that this line:

    <wsa:To>https://myserver.contoso.com/autodiscover/autodiscover.svc</wsa:To>

    has a significant (at least it seems so to me) difference to yours:

    <wsa:To>https://exch1.testDomain.com/Autodiscover/autodiscover.xml</wsa:To>

    I would guess that this means you need to use:

    ads.Url = new Uri(https://exch1.testDomain.com/AutoDiscover/autodiscover.svc);


    Mobile OWA For Smartphone
    www.leederbyshire.com
    email a@t leederbyshire d.0.t c.0.m

    • Marked as answer by Maquiladoras Thursday, June 28, 2012 3:59 PM
    Thursday, June 28, 2012 3:06 PM
  • There should be quotes around that URI, of course.  Forum scripting messing with my formatting.

    Mobile OWA For Smartphone
    www.leederbyshire.com
    email a@t leederbyshire d.0.t c.0.m

    Thursday, June 28, 2012 3:09 PM
  • OK So thanks for that! So I tried .svc and i got this error

    [AutodiscoverRequest]
    <Trace Tag="AutodiscoverResponseHttpHeaders" Tid="1" Time="2012-06-28 15:12:27Z">
    405 Method Not Allowed
    Allow: GET, HEAD, OPTIONS, TRACE
    Content-Length: 101
    Content-Type: text/html
    Date: Thu, 28 Jun 2012 15:12:27 GMT
    Server: Microsoft-IIS/7.5
    X-Powered-By: ASP.NET
    </Trace>

    Doing a little bit of research I found that when that happens, just reset the AutoDiscover virtual directory.
    Afterwards, it worked fine....

    So specifying the URL to point to .SVC and then resetting the /AutoDiscover and doing an IIS Reset.

    Now the only obstacle i'm left with is when I don't specify a URL it returns

    [AutodiscoverConfiguration]
    <Trace Tag="AutodiscoverConfiguration" Tid="1" Time="2012-06-28 15:43:19Z">
    No Autodiscover endpoints are available  for host testDomain.com
    </Trace>

    However AutoDiscoverChecker.exe returns fine , so i will look through the code and just play spot the difference :)

    Cheers!!!


    Thursday, June 28, 2012 3:59 PM
  • Hm, I'd guess that that means it can't find the required scp (service connection points, or something like that) values in active directory.  Maybe you missed out a few steps when you set up autodiscovery at the server end?

    Mobile OWA For Smartphone
    www.leederbyshire.com
    email a@t leederbyshire d.0.t c.0.m

    Thursday, June 28, 2012 6:17 PM