I have an Outlook (2013) AddIn written in C#, which worked fine when using it with TLS 1.0/1.1 enabled. However, when disabling TLS 1.2 on Exchange Server, the code does not work anymore. The code did not change when TLS 1.0/1.1 was disabled.
The error message is: "The request failed .The underlying connection was closed: An unexpected error occurred on a receive."
Here is a code snippet:
this.service = new ExchangeService();
this.service.UseDefaultCredentials = true;
this.service.Url = new Uri(this.registryValues["ExchangeUri"]);
string distributionGroup = string.Empty;
distributionGroup = this.registryValues["VerifierDistributionList"];
ExpandGroupResults myGroupMembers = this.service.ExpandGroup(distributionGroup);
// checking, if my users EmailAddress is in the group
catch (System.Exception e)
//Showing the exception in a message box
I am using .NET 4.8 to build the project, which is also installed on the Exchange Server. The Exchange Server itself is Exchange Server 2013 with the latest update (CU23).
To setup TLS 1.2 we followed this post:
This looks like an issue on how I created the ExchangeService object, but I'm still wondering why it worked before. I tried adding System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.SystemDefault; (which should be the default anyway for .NET 4.8) or System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; but for both options the error occurs. Interestingly, I can force the same error, when I use SystemDefault, when TLS 1.0/1.1 are enabled.
Do I need to change some definition in my code or is it an issue with Outlook 2013?