Outlook uses Autodiscover to locate your mailbox settings automatically. When Autodiscover returns a wrong endpoint, Outlook cannot connect to the correct Exchange server, causing repeated password prompts and connection failures. This problem usually occurs when DNS records point to an old or incorrect server URL, or when a third-party service redirects the request. This article explains why Autodiscover returns the wrong endpoint and provides a registry-based method to force Outlook to use the correct server URL.
Key Takeaways: Overriding the Autodiscover Endpoint in Outlook
- HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Outlook\AutoDiscover: Create the ‘ExcludeExplicitO365Endpoint’ DWORD to block Office 365 Autodiscover and force on-premises lookup.
- HKEY_CURRENT_USER\Software\Microsoft\Exchange: Create the ‘ProviderFlags’ DWORD to specify the exact Autodiscover URL Outlook must use.
- HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Outlook\AutoDiscover: Set ‘PreferLocalXML’ to 1 to prioritize a local XML file over DNS-based Autodiscover.
Why Autodiscover Returns a Wrong Endpoint
Autodiscover works by querying DNS for SRV records, CNAME records, or by using the email domain’s root URL. When the DNS records are stale or misconfigured, Outlook receives an incorrect server URL. Common causes include:
- An old Exchange server still listed in DNS after migration to Office 365.
- A third-party service like a spam filter or load balancer that intercepts Autodiscover requests.
- Multiple Autodiscover endpoints in DNS that return different URLs.
- A missing or incorrect Service Connection Point in Active Directory.
Outlook tries Autodiscover in a specific order: first the root domain, then the Autodiscover subdomain, then SRV records. If any of these return a wrong endpoint, the connection fails. The registry overrides described below let you skip the automatic discovery and point Outlook directly to the correct server.
How Outlook Discovers the Endpoint
Outlook checks the following sources in sequence, stopping at the first successful response:
- Service Connection Point in Active Directory (domain-joined machines)
- Root domain URL: https://domain.com/autodiscover/autodiscover.xml
- Autodiscover subdomain: https://autodiscover.domain.com/autodiscover/autodiscover.xml
- DNS SRV record: _autodiscover._tcp.domain.com
- Office 365 explicit Autodiscover endpoint
If step 5 returns a wrong URL, Outlook cannot connect. The registry fix forces Outlook to use a specific endpoint.
Steps to Override Autodiscover With Registry Edits
Before editing the registry, confirm the correct Autodiscover URL by running the Microsoft Remote Connectivity Analyzer or asking your Exchange administrator. Use the following steps to apply the override.
Method 1: Block Office 365 Autodiscover and Use On-Premises
- Close Outlook
Ensure Outlook is not running. Registry changes take effect when Outlook restarts. - Open Registry Editor
Press Windows + R, type regedit, and press Enter. Click Yes if prompted by User Account Control. - Navigate to the Autodiscover key
Go to: HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Outlook\AutoDiscover. If the AutoDiscover key does not exist, right-click the Outlook key, select New > Key, and name it AutoDiscover. - Create ExcludeExplicitO365Endpoint DWORD
Right-click in the right pane, select New > DWORD (32-bit) Value, and name it ExcludeExplicitO365Endpoint. Double-click it, set Value data to 1, and click OK. - Restart Outlook
Open Outlook. It now skips the Office 365 explicit endpoint and uses only on-premises Autodiscover methods.
Method 2: Force a Specific Autodiscover URL
- Close Outlook
Exit Outlook completely. - Open Registry Editor
Press Windows + R, type regedit, and press Enter. - Navigate to the Exchange key
Go to: HKEY_CURRENT_USER\Software\Microsoft\Exchange. If the Exchange key does not exist, create it. - Create ProviderFlags DWORD
Right-click the Exchange key, select New > Key, and name it AutoDiscover. Right-click the AutoDiscover key, select New > DWORD (32-bit) Value, and name it ProviderFlags. Set Value data to 2 (decimal). This value tells Outlook to use the provider URL specified in the next step. - Create a string value for the URL
Right-click the AutoDiscover key, select New > String Value, and name it ProviderURL. Double-click it and enter the full Autodiscover URL, for example: https://mail.contoso.com/autodiscover/autodiscover.xml. Click OK. - Restart Outlook
Open Outlook. It now uses the URL you specified instead of querying DNS.
Method 3: Use a Local XML File for Autodiscover
- Create an XML file
Create a text file named autodiscover.xml with the correct Autodiscover response. Place it in a folder accessible to Outlook, such as C:\ProgramData\Microsoft\Outlook. - Close Outlook
Exit Outlook completely. - Open Registry Editor
Press Windows + R, type regedit, and press Enter. - Navigate to the Autodiscover key
Go to: HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Outlook\AutoDiscover. - Create PreferLocalXML DWORD
Right-click in the right pane, select New > DWORD (32-bit) Value, and name it PreferLocalXML. Set Value data to 1, and click OK. - Restart Outlook
Open Outlook. It now reads the local XML file first before querying DNS.
If Outlook Still Uses the Wrong Endpoint After the Registry Fix
Outlook Ignores the Registry Override
If Outlook does not respect the registry changes, check the following:
- You edited the correct registry hive. Use HKEY_CURRENT_USER for per-user settings. For all users on the machine, edit HKEY_LOCAL_MACHINE under the same path.
- The DWORD values are set to the correct data. For ExcludeExplicitO365Endpoint, the value must be 1. For ProviderFlags, the value must be 2 (decimal).
- Outlook was restarted after the changes. A full system restart may be required if Outlook cached the old Autodiscover response.
- Group Policy is overriding the registry. Contact your IT administrator to check for Autodiscover policies in Administrative Templates.
Autodiscover Still Fails With the Correct URL
If the URL you specified is correct but Outlook still shows errors, the problem may be with the Exchange server itself. Verify that the Autodiscover XML file on the server is properly formatted and that the server returns HTTP 200 with valid XML. Use the Microsoft Remote Connectivity Analyzer to test the endpoint.
Outlook Prompts for Credentials Repeatedly
Repeated credential prompts often indicate an authentication mismatch. Ensure the Autodiscover URL uses HTTPS, not HTTP. If the server requires modern authentication, verify that Outlook is configured to use it. Go to File > Account Settings > Account Settings, select the account, and click Change. Under Offline Settings, ensure ‘Use Cached Exchange Mode’ is enabled and the correct server URL is shown.
| Item | ExcludeExplicitO365Endpoint | ProviderFlags + ProviderURL |
|---|---|---|
| Purpose | Blocks Office 365 Autodiscover to force on-premises lookup | Forces Outlook to use a specific Autodiscover URL |
| Registry location | HKCU\Software\Microsoft\Office\16.0\Outlook\AutoDiscover | HKCU\Software\Microsoft\Exchange\AutoDiscover |
| DWORD value | ExcludeExplicitO365Endpoint = 1 | ProviderFlags = 2 (decimal) + ProviderURL string |
| Best for | Hybrid deployments where Office 365 Autodiscover returns a wrong endpoint | Single on-premises Exchange server with a known URL |
| Requires URL knowledge | No | Yes |
You can now override the incorrect Autodiscover endpoint using registry edits in Outlook. Test the connection by sending a test email or checking the connection status in the Outlook tray icon. For advanced troubleshooting, enable Autodiscover logging by setting the registry key HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Outlook\Options\Mail with a DWORD named EnableLogging set to 1. This creates a log file in %temp%\Outlook Logging that shows which Autodiscover URL Outlook actually used.