NameResolutionFailure exception occurs when using server-side synchronization in Microsoft Dynamics 365

This article provides a resolution for the error message that contains NameResolutionFailure exception occurs when you test and enable a mailbox in Microsoft Dynamics 365.

Applies to:   Microsoft Dynamics C5 2016
Original KB number:   3214959

Symptoms

After you select Test and Enable on a mailbox record in Microsoft Dynamics 365, you encounter one of the following errors:

  • Email cannot not be received for the mailbox <Mailbox Name> because the email server location or the incoming email port specified in the associated email server profile <Email Server Profile Name> is incorrect. The mailbox didn't synchronize. The owner of the email server profile has been notified.
  • Mailbox <Mailbox Name> didn't synchronize appointments, contacts, and tasks because the email server location or the incoming email port specified in the associated email server profile <Email Server Profile Name> is incorrect. The owner of email server profile has been notified.
  • The email message Test Message cannot be sent because the email server location or the outgoing email port specified in the associated email server profile is incorrect. Mailbox <Mailbox Name> didn't synchronize. The owner of the email server profile <Email Server Profile Name> has been notified.

Each of the errors above also includes the following error code:

Email Server Error Code: Web server returned 1 NameResolutionFailure exception.

Cause

This error can occur if one of the Server Location values in the email server profile record are not correct or if the wrong port is specified within the Advanced section.

Resolution

Within Microsoft Dynamics 365, open the email server profile record associated with the mailbox. Verify the Server Location values and also the ports within the Advanced section.

If the values are correct, make sure the email server location is accessible by the Microsoft Dynamics 365 service. For example, if you are using Microsoft Dynamics 365 (online) with Exchange on-premises, your Exchange Web Services (EWS) URL needs to be accessible over the internet.

More information

When you select View Details, you see error details like the following:

T:124
ActivityId: <GUID>
Exception : Unhandled Exception: Microsoft.Exchange.WebServices.Data.ServiceRequestException: The request failed. The remote name could not be resolved: '<server location>'
at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.BuildEwsHttpWebRequest()
at Microsoft.Exchange.WebServices.Data.SimpleServiceRequestBase.BeginExecute(AsyncCallback callback, Object state)
at Microsoft.Crm.Asynchronous.EmailConnector.MonitoredExchangeService.BeginSyncFolderHierarchy(AsyncCallback callback, Object state, FolderId syncFolderId, PropertySet propertySet, String syncState, ExchangeItemType exchangeItemType)
at Microsoft.Crm.Asynchronous.EmailConnector.ExchangeSyncSteps.SyncFolderHierarchyStep.BeginRequest() at Microsoft.Crm.Asynchronous.EmailConnector.ExchangeSyncSteps.ExchangeSyncAsyncRemoteStep`2.BeforeCall()
at Microsoft.Crm.Asynchronous.EmailConnector.ExchangeSyncSteps.ExchangeSyncAsyncRemoteStep`2.Execute() at Microsoft.Crm.As...

ActivityId: <GUID>
Error : System.Net.WebException: The remote name could not be resolved: '<server location>'
at System.Web.Services.Protocols.WebClientAsyncResult.WaitForResponse()
at System.Web.Services.Protocols.WebClientProtocol.EndSend(IAsyncResult asyncResult, Object& internalAsyncState, Stream& responseStream)
at System.Web.Services.Protocols.SoapHttpClientProtocol.EndInvoke(IAsyncResult asyncResult)
at Microsoft.Crm.Asynchronous.EmailConnector.ExchangeServiceBinding.EndFindItem(IAsyncResult asyncResult)
at Microsoft.Crm.Asynchronous.EmailConnector.FindItemsStep.EndCall()
at Microsoft.Crm.Asynchronous.EmailConnector.ExchangeIncomingEmailProviderStep.EndOperation()

ActivityId: <GUID>
Error : System.Net.WebException: The remote name could not be resolved: '<server location>'
at System.Web.Services.Protocols.WebClientAsyncResult.WaitForResponse()
at System.Web.Services.Protocols.WebClientProtocol.EndSend(IAsyncResult asyncResult, Object& internalAsyncState, Stream& responseStream)
at System.Web.Services.Protocols.SoapHttpClientProtocol.EndInvoke(IAsyncResult asyncResult)
at Microsoft.Crm.Asynchronous.EmailConnector.ExchangeServiceBinding.EndCreateItem(IAsyncResult asyncResult)
at Microsoft.Crm.Asynchronous.EmailConnector.ExchangeOutgoingEmailProvider.EndCreateItem()