Unable to send or receive e-mail messages using the EWS protocol

Symptoms

When you attempt to send or receive an e-mail message using the EWS protocol, this error message may appear:

Error in Connect(ExchangeService.BindToFolder): The request failed. The underlying connection was closed: An unexpected error occurred on a receive. Error Code: ErrorAccessModeSpecified, Error Class: ServiceRequestException.

Cause

This issue occurs when you enable the use of the Transport Layer Security (TLS) 1.2 protocol on Microsoft Exchange Server but your registry keys are not set properly.

INFO: For details on Microsoft’s recommendations, see https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012.

Resolution

When you set the Schannel Security Support Provider (SSP) registry entries, you must ensure that the .NET Framework also uses TLS 1.2. To resolve this issue, you need to set the following registry keys:

  1. Right-click Start, click Run, type regedit and click OK.
  2. In the Registry Editor, navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319.
  3. Right-click v4.0.30319 and choose New > DWORD value from the pop-up menu.
  4. In the right pane, right-click the new item, click Rename and enter SystemDefaultTlsVersions.
  5. Right-click SystemDefaultTlsVersions, click Modify, set the value to 1 and click OK.
  6. Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319, repeat steps 3 and 4.
  7. Close your Microsoft Registry Editor.