Provider Hosted App (PHA) application errors (TLS errors and 401 errors).

Published Apr 14 2021 06:27 PM 10.1K Views
Microsoft

Note: Please take extreme caution before making any changes in Production. Make sure you test the changes in a test environment first.

 

Recently due to a spate of updates to various endpoints in SharePoint, Azure, and the AAD auth login endpoints, we are seeing projects compiled with version of .NET before 4.6 cause TLS errors which don’t always show as TLS errors in the PHA. They are intermittent sometimes due to the updating of load balanced servers. In PHAs, it sometimes shows as a 401 error due to the way the token helper PHA code works. The actual error is this:

 

"The underlying connection was closed” or “System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host”

This error is most likely due to deprecation of TLS1 1.0 & 1.1 while .NET 4.5 apps don't use TLS 1.2 without an explicit code change.

Please see:

Preparing for TLS 1.2 in Office 365 and Office 365 GCC - Microsoft 365 Compliance | Microsoft Docs

Enable TLS 1.2 on servers - Configuration Manager | Microsoft Docs

TLS 1.0 and 1.1 deprecation - Microsoft Tech Community

Transport Layer Security (TLS) best practices with the .NET Framework | Microsoft Docs

 

The updates were communicated in the Office 365 message center.

  • MC218794 - July 17, 2020 | TLS 1.0 and 1.1 retirement date in Office 365 to be October 15, 2020
  • MC240160 - Feb 16, 2021 | Reminder: Disabling TLS 1.0 and TLS 1.1 in Microsoft 365

The deprecation of TLS 1.0 and 1.1 on all SharePoint Online servers will be completed by June of 2021. There are no rollbacks to this security update.

Additionally, these are the only ciphers that will be supported for TLS 1.2 connections-

  • TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
  • TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
  • TLS_DHE_RSA_WITH_AES_256_GCM_SHA384
  • TLS_DHE_RSA_WITH_AES_128_GCM_SHA256

Additionally, Windows Server versions 2012 R2 and before have a bug in TLS_DHE* cipher suites that may cause them to fail, and there is no fix for those versions. For Server 2016 and later you can disable TLS_DHE* ciphers since they support the 2 TLS_ECDHE* ciphers, but earlier server versions will not work reliably. More information here-
Errors when applications try to connect to SQL Server in Windows - Windows Server | Microsoft Docs

Windows Server 2008 and 2008 R2 extended security updates | Microsoft Docs

 

The recommendation is to upgrade to at least server 2016.

 

Checking which TLS and ciphers are used

To see which version of TLS, and which ciphers are supported by the client machine, you can take a network trace with a tool like Wireshark which we are using here, or any others that can take .cap captures. Get the resolved IP address of your SharePoint server by using ping as follows-

SPDev_Support_0-1621529078394.png

Make a note of that IP.

Next take your network capture while causing the failing network call to happen. In Wireshark you start by selecting your network interface-

 

SPDev_Support_2-1621529716368.png

After reproducing the problem with the trace running, stop the trace, and use the SharePoint online IP noted above to filter the network trace as follows-

SPDev_Support_1-1621529125432.png

Take note of the TLS version and the ciphers.

If the connection is being rejected due to TLS version/protocol issues, you will see a response with the RST flag set, in Wireshark it is highlighted in red. The flags are displayed as [RST, ACK].

You can compare this with the supported cipher list mentioned earlier in this article.

Windows 2016 and up have the proper ciphers enabled, but many admins will disable them.

One way the ciphers are disabled is by disabling RSA support with this key-

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\KeyExchangeAlgorithms\PKCS]

    "Enabled" = dword:00000000

If this key is present, change the value of 'Enabled' to 0xffffffff.

 

If this isn't the issue, then you may need to change cipher settings in windows with these articles-
Manage Transport Layer Security (TLS) | Microsoft Docs
(using group policy on the local or domain policy to set which ciphers and their order)

TLS Module | Microsoft Docs

(using Get-TlsCipherSuite and Enable-TlsCipherSuite commands in Powershell on Windows server 2016+)


More info on cipher suites-
Cipher Suites in TLS/SSL (Schannel SSP) - Win32 apps | Microsoft Docs

 

Scenarios

In all scenarios on a VM or physical server

you first need to add the following registry key settings on any web servers or hosts/workstations running .NET executables:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319]

"SystemDefaultTlsVersions" = dword:00000001

"SchUseStrongCrypto" = dword:00000001

 

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319]

"SystemDefaultTlsVersions" = dword:00000001

"SchUseStrongCrypto"=dword:00000001

 

Note: You will need to restart your server(s)

After this, you will need to do one of the following depending on the application type (web app, executable, WCF).

 

If the app web is hosted on-premise in IIS

After the registry steps above, modify the targetFramework attribute on the httpRuntime element as follows-

<httpRuntime targetFramework="4.7.1"/>

Any version equal or greater than .NET 4.6+ will work, but we recommend at least 4.7+.

 

If the App web is hosted on Azure

Log into the Azure portal (portal.azure.com) with an account with admin rights on the web app in question.

Once you open the App Services and select the web app hosting the PHA site, click on the App Service Editor (Preview).

SPDev_Support_0-1618449668859.png

 

This will open the editor, then select the web.config file and change the circled targetFramework attribute to 4.7 preferably (any setting higher than 4.6 will work too). Note the status in the upper right will say ‘DIRTY’ for a bit, then it should auto-save and change back to ‘SAVED’-

SPDev_Support_1-1618449668895.png

 

At this point you should be set, refresh the page with the PHA and all should be good.

 

If your application is an Azure web job, Executable (e.g. console, WPF, Windows Forms, etc.), or WCF service

The .NET registry keys mentioned above need to be applied on the host machine that runs the application (except for the Azure case).

Then the application project in Visual Studio needs to be retargeted to 4.6+ (4.7.1+ recommended) by changing the target framework setting in the application properties and re-compiling. The Azure web job executable will need to be updated with the re-compiled executable.

 

More here-

Targeted .NET frameworks - Visual Studio | Microsoft Docs

 

If you want to read up on known issues for specific re-targeting scenarios, you can select the from/to versions and see the known issues-

Runtime and retargeting changes - .NET Framework | Microsoft Docs

 

Note: You can’t use the config file for the exe to re-target the same way we can for a web application.

 

If you are running an app on Java
You can find more information here- 
 
If you want to continue to use .NET 4.5.x apps (NOT RECOMMENDED)
This is NOT recommended since it takes the same time to retarget the framework and re-compile, and it requires adding a line of code. Only use this if there is a valid reason to not re-target to .NET 4.6+. This line will enable TLS 1.1 and 1.2, you can add or remove protocols that are in the SecurityProtocolType enumeration-
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;

I emphasize, this should not be used except as a last resort to an impediment to re-targeting to .NET 4.6+
 
 
9 Comments
Occasional Contributor

Is this something that would be intermittent? Or would it be something that once it breaks ends up being constant? As well, in the HTTP response body is there any message indicating the cause as TLS so we can verify if this is indeed the issue?

Microsoft

Yes. We have seen this would be both intermittent and constant. In the response body "The underlying connection was closed: An unexpected error occurred on a send." is the most consistent message we have seen. We have also seen Tls stream error messages in the stack trace.

Microsoft

Make sure to put in the strong crypto key for 64 and 32 bit compilation, as VS projects default to prefer 32 bit, and if that key is missing (the Wow6432Node one), those programs will still use the older TLS-
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319]
"SchUseStrongCrypto"=dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319]
"SchUseStrongCrypto"=dword:00000001

Occasional Visitor

If we do the retargeting and also explicitly set this following in global.asax, would there be any issues?

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;

 

Microsoft

It will work fine, but might keep it from using TLS13 in the future when that protocol is introduced or enforced.

Hard-coding the protocols should be avoided.

Since the code is in the global.asax, it isn't as bad since you can edit it and it will re-compile; you could also put the settings in a web.config and that would be a little better.

 

Leaving it up to .NET and the OS is best, then you just make sure the OS has the support installed/enabled, and you are ready to go with no changes to your application.

Occasional Visitor

Thank you for the reply!

What would these changes look like in web.config?

 

I currently have customers reporting errors that resolve to "The underlying connection was closed: An unexpected error occurred on a send.". And, while I've made most of the changes included in this article, namely upgrading to .NET 4.7.2 and retargeting. When that didn't work, I added the line of code to Global.asax. However, it still yields the same outcome. It happens when using CSOM.

Is there something special that needs to be done to make CSOM calls after making these TLS changes? I upgraded it to 16.1.0.0 hoping that would help.

Microsoft

The changes in the web.config would be app config entries with the protocols, and you would need some code to pick them up and set the TLS.

The other issue that people are hitting is that only 4 ciphers in TLS 1.2 are supported in the changes happening now, and if you have disabled these, the TLS 1.2 connections will fail. I have updated the above article to include some of this info.

Occasional Visitor

I had 2 issues and was getting the same error. 

The first thing is my client Id and Client secret was expired. If you create app through /_layouts/15/appregnew.aspx it's expiry is 1 year. If you want to increase expiry by more than 1 year you can use the PowerShell script given in the below link.

https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/replace-an-expiring-client-secret-in-a-sh...

 

Secondly, I have a 4.5 framework console application and able to reproduce this issue on windows server 2012 R2. Even after I get updated client Id and secret and  I changed the .Net framework to 4.6+ or 4.7 still able to reproduce this issue. So I have to have the following line of code before calling a method to get an access token.

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

 

This resolved my issue at least for now.  

Microsoft

You don't need to hardcode, unless your executable is compiled with .NET 4.5. If you recompiled to 4.6 or 4.7 (you can't use the config file for this, you have to re-compile in VS) then the registry keys should work.

%3CLINGO-SUB%20id%3D%22lingo-sub-2297729%22%20slang%3D%22en-US%22%3ERe%3A%20Provider%20Hosted%20App%20(PHA)%20application%20errors%20(TLS%20errors%20and%20401%20errors).%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2297729%22%20slang%3D%22en-US%22%3E%3CP%3EIs%20this%20something%20that%20would%20be%20intermittent%3F%20Or%20would%20it%20be%20something%20that%20once%20it%20breaks%20ends%20up%20being%20constant%3F%20As%20well%2C%20in%20the%20HTTP%20response%20body%20is%20there%20any%20message%20indicating%20the%20cause%20as%20TLS%20so%20we%20can%20verify%20if%20this%20is%20indeed%20the%20issue%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2304635%22%20slang%3D%22en-US%22%3ERe%3A%20Provider%20Hosted%20App%20(PHA)%20application%20errors%20(TLS%20errors%20and%20401%20errors).%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2304635%22%20slang%3D%22en-US%22%3E%3CP%3EMake%20sure%20to%20put%20in%20the%20strong%20crypto%20key%20for%2064%20and%2032%20bit%20compilation%2C%20as%20VS%20projects%20default%20to%20prefer%2032%20bit%2C%20and%20if%20that%20key%20is%20missing%20(the%20Wow6432Node%20one)%2C%20those%20programs%20will%20still%20use%20the%20older%20TLS-%3CBR%20%2F%3EWindows%20Registry%20Editor%20Version%205.00%3CBR%20%2F%3E%5BHKEY_LOCAL_MACHINE%5CSOFTWARE%5CMicrosoft%5C.NETFramework%5Cv4.0.30319%5D%3CBR%20%2F%3E%22SchUseStrongCrypto%22%3Ddword%3A00000001%3CBR%20%2F%3E%5BHKEY_LOCAL_MACHINE%5CSOFTWARE%5CWow6432Node%5CMicrosoft%5C.NETFramework%5Cv4.0.30319%5D%3CBR%20%2F%3E%22SchUseStrongCrypto%22%3Ddword%3A00000001%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2365981%22%20slang%3D%22en-US%22%3ERe%3A%20Provider%20Hosted%20App%20(PHA)%20application%20errors%20(TLS%20errors%20and%20401%20errors).%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2365981%22%20slang%3D%22en-US%22%3E%3CP%3EIf%20we%20do%20the%20retargeting%20and%20also%20explicitly%20set%20this%20following%20in%20global.asax%2C%20would%20there%20be%20any%20issues%3F%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CPRE%3E%3CSPAN%3EServicePointManager%3C%2FSPAN%3E%3CSPAN%3E.%3C%2FSPAN%3E%3CSPAN%3ESecurityProtocol%3C%2FSPAN%3E%26nbsp%3B%3CSPAN%3E%3D%3C%2FSPAN%3E%26nbsp%3B%3CSPAN%3ESecurityProtocolType%3C%2FSPAN%3E%3CSPAN%3E.%3C%2FSPAN%3E%3CSPAN%3ETls12%3C%2FSPAN%3E%20%7C%20%3CSPAN%3ESecurityProtocolType%3C%2FSPAN%3E%3CSPAN%3E.%3C%2FSPAN%3E%3CSPAN%3ETls11%3C%2FSPAN%3E%26nbsp%3B%3CSPAN%3E%7C%3C%2FSPAN%3E%26nbsp%3B%3CSPAN%3ESecurityProtocolType%3C%2FSPAN%3E%3CSPAN%3E.%3C%2FSPAN%3E%3CSPAN%3ETls%3C%2FSPAN%3E%3CSPAN%3E%3B%3C%2FSPAN%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2366645%22%20slang%3D%22en-US%22%3ERe%3A%20Provider%20Hosted%20App%20(PHA)%20application%20errors%20(TLS%20errors%20and%20401%20errors).%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2366645%22%20slang%3D%22en-US%22%3E%3CP%3EIt%20will%20work%20fine%2C%20but%20might%20keep%20it%20from%20using%20TLS13%20in%20the%20future%20when%20that%20protocol%20is%20introduced%20or%20enforced.%3C%2FP%3E%0A%3CP%3EHard-coding%20the%20protocols%20should%20be%20avoided.%3C%2FP%3E%0A%3CP%3ESince%20the%20code%20is%20in%20the%20global.asax%2C%20it%20isn't%20as%20bad%20since%20you%20can%20edit%20it%20and%20it%20will%20re-compile%3B%20you%20could%20also%20put%20the%20settings%20in%20a%20web.config%20and%20that%20would%20be%20a%20little%20better.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ELeaving%20it%20up%20to%20.NET%20and%20the%20OS%20is%20best%2C%20then%20you%20just%20make%20sure%20the%20OS%20has%20the%20support%20installed%2Fenabled%2C%20and%20you%20are%20ready%20to%20go%20with%20no%20changes%20to%20your%20application.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2369075%22%20slang%3D%22en-US%22%3ERe%3A%20Provider%20Hosted%20App%20(PHA)%20application%20errors%20(TLS%20errors%20and%20401%20errors).%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2369075%22%20slang%3D%22en-US%22%3E%3CP%3EThank%20you%20for%20the%20reply!%3CBR%20%2F%3E%3CBR%20%2F%3EWhat%20would%20these%20changes%20look%20like%20in%20web.config%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20currently%20have%20customers%20reporting%20errors%20that%20resolve%20to%20%22The%26nbsp%3Bunderlying%26nbsp%3Bconnection%26nbsp%3Bwas%26nbsp%3Bclosed%3A%26nbsp%3BAn%26nbsp%3Bunexpected%26nbsp%3Berror%26nbsp%3Boccurred%26nbsp%3Bon%26nbsp%3Ba%26nbsp%3Bsend.%22.%20And%2C%20while%20I've%20made%20most%20of%20the%20changes%20included%20in%20this%20article%2C%20namely%20upgrading%20to%20.NET%204.7.2%20and%20retargeting.%20When%20that%20didn't%20work%2C%20I%20added%20the%20line%20of%20code%20to%20Global.asax.%20However%2C%20it%20still%20yields%20the%20same%20outcome.%20It%20happens%20when%20using%20CSOM.%3CBR%20%2F%3E%3CBR%20%2F%3EIs%20there%20something%20special%20that%20needs%20to%20be%20done%20to%20make%20CSOM%20calls%20after%20making%20these%20TLS%20changes%3F%20I%20upgraded%20it%20to%2016.1.0.0%20hoping%20that%20would%20help.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2373939%22%20slang%3D%22en-US%22%3ERe%3A%20Provider%20Hosted%20App%20(PHA)%20application%20errors%20(TLS%20errors%20and%20401%20errors).%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2373939%22%20slang%3D%22en-US%22%3E%3CP%3EThe%20changes%20in%20the%20web.config%20would%20be%20app%20config%20entries%20with%20the%20protocols%2C%20and%20you%20would%20need%20some%20code%20to%20pick%20them%20up%20and%20set%20the%20TLS.%3C%2FP%3E%0A%3CP%3EThe%20other%20issue%20that%20people%20are%20hitting%20is%20that%20only%204%20ciphers%20in%20TLS%201.2%20are%20supported%20in%20the%20changes%20happening%20now%2C%20and%20if%20you%20have%20disabled%20these%2C%20the%20TLS%201.2%20connections%20will%20fail.%20I%20have%20updated%20the%20above%20article%20to%20include%20some%20of%20this%20info.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2273611%22%20slang%3D%22en-US%22%3EProvider%20Hosted%20App%20(PHA)%20application%20errors%20(TLS%20errors%20and%20401%20errors).%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2273611%22%20slang%3D%22en-US%22%3E%3CP%3E%3CFONT%20color%3D%22%23FF0000%22%3E%3CU%3E%3CSTRONG%3ENote%3A%20Please%20take%20extreme%20caution%20before%20making%20any%20changes%20in%20Production.%20Make%20sure%20you%20test%20the%20changes%20in%20a%20test%20environment%20first.%3C%2FSTRONG%3E%3C%2FU%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ERecently%20due%20to%20a%20spate%20of%20updates%20to%20various%20endpoints%20in%20SharePoint%2C%20Azure%2C%20and%20the%20AAD%20auth%20login%20endpoints%2C%20we%20are%20seeing%20projects%20compiled%20with%20version%20of%20.NET%20before%204.6%20cause%20TLS%20errors%20which%20don%E2%80%99t%20always%20show%20as%20TLS%20errors%20in%20the%20PHA.%20They%20are%20intermittent%20sometimes%20due%20to%20the%20updating%20of%20load%20balanced%20servers.%20In%20PHAs%2C%20it%20sometimes%20shows%20as%20a%20401%20error%20due%20to%20the%20way%20the%20token%20helper%20PHA%20code%20works.%20The%20actual%20error%20is%20this%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%22The%20underlying%20connection%20was%20closed%E2%80%9D%20or%20%E2%80%9CSystem.Net.Sockets.SocketException%3A%20An%20existing%20connection%20was%20forcibly%20closed%20by%20the%20remote%20host%E2%80%9D%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EThis%20error%20is%20most%20likely%20due%20to%20deprecation%20of%20TLS1%201.0%20%26amp%3B%201.1%20while%20.NET%204.5%20apps%20don't%20use%20TLS%201.2%20without%20an%20explicit%20code%20change.%3C%2FP%3E%0A%3CP%3EPlease%20see%3A%3C%2FP%3E%0A%3CP%3E%3CU%3E%3CA%20href%3D%22https%3A%2F%2Fnam06.safelinks.protection.outlook.com%2F%3Furl%3Dhttps%253A%252F%252Fdocs.microsoft.com%252Fen-us%252Fmicrosoft-365%252Fcompliance%252Fprepare-tls-1.2-in-office-365%253Fview%253Do365-worldwide%26amp%3Bdata%3D04%257C01%257Cmamcv%2540microsoft.com%257C1b4a0173e21c454a5e6b08d8f4780658%257C72f988bf86f141af91ab2d7cd011db47%257C1%257C0%257C637528143640405393%257CUnknown%257CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%253D%257C1000%26amp%3Bsdata%3DDSWr33W1sSz%252FP9jJK3YzZdXyPFbb9dZ9ncmkemZKTE0%253D%26amp%3Breserved%3D0%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3EPreparing%20for%20TLS%201.2%20in%20Office%20365%20and%20Office%20365%20GCC%20-%20Microsoft%20365%20Compliance%20%7C%20Microsoft%20Docs%3C%2FA%3E%3C%2FU%3E%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fmem%2Fconfigmgr%2Fcore%2Fplan-design%2Fsecurity%2Fenable-tls-1-2-server%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EEnable%20TLS%201.2%20on%20servers%20-%20Configuration%20Manager%20%7C%20Microsoft%20Docs%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fmicrosoft-sharepoint-blog%2Ftls-1-0-and-1-1-deprecation%2Fba-p%2F1620264%22%20target%3D%22_blank%22%3ETLS%201.0%20and%201.1%20deprecation%20-%20Microsoft%20Tech%20Community%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fdotnet%2Fframework%2Fnetwork-programming%2Ftls%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ETransport%20Layer%20Security%20(TLS)%20best%20practices%20with%20the%20.NET%20Framework%20%7C%20Microsoft%20Docs%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20updates%20were%20communicated%20in%20the%20Office%20365%20message%20center.%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EMC218794%20-%20July%2017%2C%202020%20%7C%20TLS%201.0%20and%201.1%20retirement%20date%20in%20Office%20365%20to%20be%20October%2015%2C%202020%3C%2FLI%3E%0A%3CLI%3EMC240160%20-%20Feb%2016%2C%202021%20%7C%20Reminder%3A%20Disabling%20TLS%201.0%20and%20TLS%201.1%20in%20Microsoft%20365%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EThe%20deprecation%20of%20TLS%201.0%20and%201.1%20on%20all%20SharePoint%20Online%20servers%20will%20be%20completed%20by%20%3CU%3EJune%20of%202021%3C%2FU%3E.%20There%20are%20no%20rollbacks%20to%20this%20security%20update.%3CBR%20%2F%3E%3CBR%20%2F%3EAdditionally%2C%20these%20are%20the%20%3CU%3Eonly%20ciphers%3C%2FU%3E%20that%20will%20be%20supported%20for%20%3CU%3ETLS%201.2%3C%2FU%3E%20connections-%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3ETLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384%3C%2FLI%3E%0A%3CLI%3ETLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256%3C%2FLI%3E%0A%3CLI%3ETLS_DHE_RSA_WITH_AES_256_GCM_SHA384%3C%2FLI%3E%0A%3CLI%3ETLS_DHE_RSA_WITH_AES_128_GCM_SHA256%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EAdditionally%2C%20Windows%20Server%20versions%202012%20R2%20and%20before%20have%20a%20bug%20in%20TLS_DHE*%20cipher%20suites%20that%20may%20cause%20them%20to%20fail%2C%20and%20there%20is%20no%20fix%20for%20those%20versions.%20For%20Server%202016%20and%20later%20you%20can%20disable%20TLS_DHE*%20ciphers%20since%20they%20support%20the%202%20TLS_ECDHE*%20ciphers%2C%20but%20earlier%20server%20versions%20will%20not%20work%20reliably.%20More%20information%20here-%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Ftroubleshoot%2Fwindows-server%2Fidentity%2Fapps-forcibly-closed-tls-connection-errors%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EErrors%20when%20applications%20try%20to%20connect%20to%20SQL%20Server%20in%20Windows%20-%20Windows%20Server%20%7C%20Microsoft%20Docs%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows-server%2Fget-started%2Fextended-security-updates%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EWindows%20Server%202008%20and%202008%20R2%20extended%20security%20updates%20%7C%20Microsoft%20Docs%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20recommendation%20is%20to%20upgrade%20to%20at%20least%20server%202016.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CU%3E%3CSTRONG%3EChecking%20which%20TLS%20and%20ciphers%20are%20used%3C%2FSTRONG%3E%3C%2FU%3E%3C%2FP%3E%0A%3CP%3ETo%20see%20which%20version%20of%20TLS%2C%20and%20which%20ciphers%20are%20supported%20by%20the%20client%20machine%2C%20you%20can%20take%20a%20network%20trace%20with%20a%20tool%20like%20Wireshark%20which%20we%20are%20using%20here%2C%20or%20any%20others%20that%20can%20take%20.cap%20captures.%20Get%20the%20resolved%20IP%20address%20of%20your%20SharePoint%20server%20by%20using%20ping%20as%20follows-%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22SPDev_Support_0-1621529078394.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F282233iE08C90BFB5D06294%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22SPDev_Support_0-1621529078394.png%22%20alt%3D%22SPDev_Support_0-1621529078394.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EMake%20a%20note%20of%20that%20IP.%3C%2FP%3E%0A%3CP%3ENext%20take%20your%20network%20capture%20while%20causing%20the%20failing%20network%20call%20to%20happen.%20In%20Wireshark%20you%20start%20by%20selecting%20your%20network%20interface-%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22SPDev_Support_2-1621529716368.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F282237i8C1DFB46EC6EC23E%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SPDev_Support_2-1621529716368.png%22%20alt%3D%22SPDev_Support_2-1621529716368.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EAfter%20reproducing%20the%20problem%20with%20the%20trace%20running%2C%20stop%20the%20trace%2C%20and%26nbsp%3Buse%20the%20SharePoint%20online%20IP%20noted%20above%20to%20filter%20the%20network%20trace%20as%20follows-%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22SPDev_Support_1-1621529125432.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F282235i581402A2B224AAAA%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22SPDev_Support_1-1621529125432.png%22%20alt%3D%22SPDev_Support_1-1621529125432.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3ETake%20note%20of%20the%20TLS%20version%20and%20the%20ciphers.%3C%2FP%3E%0A%3CP%3EIf%20the%20connection%20is%20being%20rejected%20due%20to%20TLS%20version%2Fprotocol%20issues%2C%20you%20will%20see%20a%20response%20with%20the%20RST%20flag%20set%2C%20in%20Wireshark%20it%20is%20highlighted%20in%20red.%20The%20flags%20are%20displayed%20as%20%5BRST%2C%20ACK%5D.%3C%2FP%3E%0A%3CP%3EYou%20can%20compare%20this%20with%20the%20supported%20cipher%20list%20mentioned%20earlier%20in%20this%20article.%3C%2FP%3E%0A%3CP%3EWindows%202016%20and%20up%20have%20the%20proper%20ciphers%20enabled%2C%20but%20many%20admins%20will%20disable%20them.%3C%2FP%3E%0A%3CP%3EOne%20way%20the%20ciphers%20are%20disabled%20is%20by%20disabling%20RSA%20support%20with%20this%20key-%3C%2FP%3E%0A%3CP%20class%3D%22xmsonormal%22%20style%3D%22background%3A%20lightgoldenrodyellow%3B%22%3E%3CSTRONG%3E%3CSPAN%20style%3D%22color%3A%20%23333333%3B%22%3E%5BHKEY_LOCAL_MACHINE%5CSYSTEM%5CCurrentControlSet%5CControl%5CSecurityProviders%5CSCHANNEL%5CKeyExchangeAlgorithms%5CPKCS%5D%3C%2FSPAN%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%20class%3D%22xmsonormal%22%20style%3D%22background%3A%20lightgoldenrodyellow%3B%22%3E%3CSTRONG%3E%3CSPAN%20style%3D%22color%3A%20%23333333%3B%22%3E%26nbsp%3B%20%26nbsp%3B%20%22Enabled%22%20%3D%20%3CSPAN%20style%3D%22font-weight%3A%20bold%3B%22%3Edword%3A00000000%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EIf%20this%20key%20is%20present%2C%20change%20the%20value%20of%20'%3CSTRONG%3EEnabled%3C%2FSTRONG%3E'%20to%26nbsp%3B%3CSTRONG%3E0xffffffff%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20this%20isn't%20the%20issue%2C%20then%20you%20may%20need%20to%20change%20cipher%20settings%20in%20windows%20with%20these%20articles-%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows-server%2Fsecurity%2Ftls%2Fmanage-tls%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EManage%20Transport%20Layer%20Security%20(TLS)%20%7C%20Microsoft%20Docs%3C%2FA%3E%3CBR%20%2F%3E(using%20group%20policy%20on%20the%20local%20or%20domain%20policy%20to%20set%20which%20ciphers%20and%20their%20order)%3CBR%20%2F%3E%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Ftls%2F%3Fview%3Dwindowsserver2019-ps%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ETLS%20Module%20%7C%20Microsoft%20Docs%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E(using%20Get-TlsCipherSuite%20and%20Enable-TlsCipherSuite%20commands%20in%20Powershell%20on%20Windows%20server%202016%2B)%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EMore%20info%20on%20cipher%20suites-%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows%2Fwin32%2Fsecauthn%2Fcipher-suites-in-schannel%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ECipher%20Suites%20in%20TLS%2FSSL%20(Schannel%20SSP)%20-%20Win32%20apps%20%7C%20Microsoft%20Docs%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%225%22%3E%3CSTRONG%3EScenarios%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CU%3E%3CSTRONG%3EIn%20all%20scenarios%20on%20a%20VM%20or%20physical%20server%3C%2FSTRONG%3E%3C%2FU%3E%3C%2FP%3E%0A%3CP%3Eyou%20first%20need%20to%20add%20the%20following%20registry%20key%20settings%20on%20any%20web%20servers%20or%20hosts%2Fworkstations%20running%20.NET%20executables%3A%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CSPAN%20style%3D%22font-weight%3A%20bold%3B%22%3E%5BHKEY_LOCAL_MACHINE%5CSOFTWARE%5CMicrosoft%5C.NETFramework%5Cv4.0.30319%5D%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CSPAN%20style%3D%22font-weight%3A%20bold%3B%22%3E%22SystemDefaultTlsVersions%22%20%3D%20dword%3A00000001%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CSPAN%20style%3D%22font-weight%3A%20bold%3B%22%3E%22SchUseStrongCrypto%22%20%3D%20dword%3A00000001%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CSPAN%20style%3D%22font-weight%3A%20bold%3B%22%3E%5BHKEY_LOCAL_MACHINE%5CSOFTWARE%5CWow6432Node%5CMicrosoft%5C.NETFramework%5Cv4.0.30319%5D%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CSPAN%20style%3D%22font-weight%3A%20bold%3B%22%3E%22SystemDefaultTlsVersions%22%20%3D%20dword%3A00000001%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CSPAN%20style%3D%22font-weight%3A%20bold%3B%22%3E%22SchUseStrongCrypto%22%3Ddword%3A00000001%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%3CSPAN%20style%3D%22font-weight%3A%20bold%3B%20text-decoration%3A%20underline%3B%22%3ENote%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-weight%3A%20bold%3B%22%3E%3A%20You%20will%20need%20to%20restart%20your%20server(s)%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EAfter%20this%2C%20you%20will%20need%20to%20do%20one%20of%20the%20following%20depending%20on%20the%20application%20type%20(web%20app%2C%20executable%2C%20WCF).%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CU%3E%3CSTRONG%3EIf%20the%20app%20web%20is%20hosted%20on-premise%20in%20IIS%3C%2FSTRONG%3E%3C%2FU%3E%3C%2FP%3E%0A%3CP%3EAfter%20the%20registry%20steps%20above%2C%20modify%20the%20targetFramework%20attribute%20on%20the%20httpRuntime%20element%20as%20follows-%3C%2FP%3E%0A%3CP%3E%3CHTTPRUNTIME%3EtargetFramework%3D%22%3CSTRONG%3E4.7.1%3C%2FSTRONG%3E%3CSTRONG%3E%22%3C%2FSTRONG%3E%2F%26gt%3B%3C%2FHTTPRUNTIME%3E%3C%2FP%3E%0A%3CP%3EAny%20version%20equal%20or%20greater%20than%20.NET%204.6%2B%20will%20work%2C%20but%20we%20recommend%20at%20least%204.7%2B.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CU%3EIf%20the%20App%20web%20is%20hosted%20on%20Azure%3C%2FU%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3ELog%20into%20the%20Azure%20portal%20(portal.azure.com)%20with%20an%20account%20with%20admin%20rights%20on%20the%20web%20app%20in%20question.%3C%2FP%3E%0A%3CP%3EOnce%20you%20open%20the%20App%20Services%20and%20select%20the%20web%20app%20hosting%20the%20PHA%20site%2C%20click%20on%20the%20App%20Service%20Editor%20(Preview).%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22SPDev_Support_0-1618449668859.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F272955i28EF830997DC2E5F%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SPDev_Support_0-1618449668859.png%22%20alt%3D%22SPDev_Support_0-1618449668859.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20will%20open%20the%20editor%2C%20then%20select%20the%20%3CSTRONG%3Eweb.config%3C%2FSTRONG%3E%20file%20and%20change%20the%20circled%20%3CSTRONG%3EtargetFramework%3C%2FSTRONG%3E%20attribute%20to%204.7%20preferably%20(any%20setting%20higher%20than%204.6%20will%20work%20too).%20Note%20the%20status%20in%20the%20upper%20right%20will%20say%20%E2%80%98%3CSTRONG%3EDIRTY%3C%2FSTRONG%3E%E2%80%99%20for%20a%20bit%2C%20then%20it%20should%20auto-save%20and%20change%20back%20to%20%E2%80%98%3CSTRONG%3ESAVED%3C%2FSTRONG%3E%E2%80%99-%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22SPDev_Support_1-1618449668895.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F272954iBDD403B49258F7B8%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22SPDev_Support_1-1618449668895.png%22%20alt%3D%22SPDev_Support_1-1618449668895.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAt%20this%20point%20you%20should%20be%20set%2C%20refresh%20the%20page%20with%20the%20PHA%20and%20all%20should%20be%20good.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CU%3EIf%20your%20application%20is%20an%20Azure%20web%20job%2C%20Executable%20(e.g.%20console%2C%20WPF%2C%20Windows%20Forms%2C%20etc.)%2C%20or%20WCF%20service%3C%2FU%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EThe%20.NET%20registry%20keys%20mentioned%20above%20need%20to%20be%20applied%20on%20the%20host%20machine%20that%20runs%20the%20application%20(except%20for%20the%20Azure%20case).%3C%2FP%3E%0A%3CP%3EThen%20the%20application%20project%20in%20Visual%20Studio%20needs%20to%20be%20retargeted%20to%204.6%2B%20(4.7.1%2B%20recommended)%20by%20changing%20the%20target%20framework%20setting%20in%20the%20application%20properties%20and%20re-compiling.%20The%20Azure%20web%20job%20executable%20will%20need%20to%20be%20updated%20with%20the%20re-compiled%20executable.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EMore%20here-%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fvisualstudio%2Fide%2Fvisual-studio-multi-targeting-overview%3Fview%3Dvs-2019%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ETargeted%20.NET%20frameworks%20-%20Visual%20Studio%20%7C%20Microsoft%20Docs%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20you%20want%20to%20read%20up%20on%20known%20issues%20for%20specific%20re-targeting%20scenarios%2C%20you%20can%20select%20the%20from%2Fto%20versions%20and%20see%20the%20known%20issues-%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fdotnet%2Fframework%2Fmigration-guide%2Fapplication-compatibility%3Fredirectedfrom%3DMSDN%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ERuntime%20and%20retargeting%20changes%20-%20.NET%20Framework%20%7C%20Microsoft%20Docs%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CU%3E%3CSTRONG%3ENote%3C%2FSTRONG%3E%3C%2FU%3E%3A%20You%20can%E2%80%99t%20use%20the%20config%20file%20for%20the%20exe%20to%20re-target%20the%20same%20way%20we%20can%20for%20a%20web%20application.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CDIV%3E%3CSTRONG%3E%3CU%3EIf%20you%20are%20running%20an%20app%20on%20Java%3C%2FU%3E%3C%2FSTRONG%3E%3C%2FDIV%3E%0A%3CDIV%3EYou%20can%20find%20more%20information%20here-%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%3E%3CA%20href%3D%22https%3A%2F%2Fwww.java.com%2Fen%2Fconfigure_crypto.html%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3EConfigure%20Oracle's%20JDK%20and%20JRE%20Cryptographic%20Algorithms%20(java.com)%3C%2FA%3E%3C%2FDIV%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%3E%3CU%3E%3CSTRONG%3EIf%20you%20want%20to%20continue%20to%20use%20.NET%204.5.x%20apps%20(NOT%20RECOMMENDED)%3C%2FSTRONG%3E%3C%2FU%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CU%3E%3C%2FU%3EThis%20is%20%3CU%3ENOT%3C%2FU%3E%20recommended%20since%20it%20takes%20the%20same%20time%20to%20retarget%20the%20framework%20and%20re-compile%2C%20and%20it%20requires%20adding%20a%20line%20of%20code.%20Only%20use%20this%20if%20there%20is%20a%20valid%20reason%20to%20not%20re-target%20to%20.NET%204.6%2B.%20This%20line%20will%20enable%20TLS%201.1%20and%201.2%2C%20you%20can%20add%20or%20remove%20protocols%20that%20are%20in%20the%20SecurityProtocolType%20enumeration-%3C%2FDIV%3E%0A%3CDIV%3E%0A%3CPRE%3E%3CSPAN%3EServicePointManager%3C%2FSPAN%3E%3CSPAN%3E.%3C%2FSPAN%3E%3CSPAN%3ESecurityProtocol%3C%2FSPAN%3E%26nbsp%3B%3CSPAN%3E%3D%3C%2FSPAN%3E%26nbsp%3B%3CSPAN%3ESecurityProtocolType%3C%2FSPAN%3E%3CSPAN%3E.%3C%2FSPAN%3E%3CSPAN%3ETls11%3C%2FSPAN%3E%26nbsp%3B%3CSPAN%3E%7C%3C%2FSPAN%3E%26nbsp%3B%3CSPAN%3ESecurityProtocolType%3C%2FSPAN%3E%3CSPAN%3E.%3C%2FSPAN%3E%3CSPAN%3ETls12%3C%2FSPAN%3E%3CSPAN%3E%3B%3C%2FSPAN%3E%0A%3C%2FPRE%3E%0A%3CP%3E%3CLI-WRAPPER%3E%3C%2FLI-WRAPPER%3E%3C%2FP%3E%0A%3C%2FDIV%3E%0A%3CDIV%3EI%20emphasize%2C%20this%20should%20not%20be%20used%20except%20as%20a%20last%20resort%20to%20an%20impediment%20to%20re-targeting%20to%20.NET%204.6%2B%3C%2FDIV%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-2273611%22%20slang%3D%22en-US%22%3E%3CP%3EProvider%20Hosted%20App%20(PHA)%20application%20errors%20(TLS%20errors%20and%20401%20errors).%20%E2%80%9CThe%20underlying%20connection%20was%20closed%E2%80%9D%20or%20%E2%80%9CSystem.Net.Sockets.SocketException%3A%20An%20existing%20connection%20was%20forcibly%20closed%20by%20the%20remote%20host%E2%80%9D.%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2273611%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDeveloper%20Support%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2417229%22%20slang%3D%22en-US%22%3ERe%3A%20Provider%20Hosted%20App%20(PHA)%20application%20errors%20(TLS%20errors%20and%20401%20errors).%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2417229%22%20slang%3D%22en-US%22%3E%3CP%3EI%20had%202%20issues%20and%20was%20getting%20the%20same%20error.%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20first%20thing%20is%20my%20client%20Id%20and%20Client%20secret%20was%20expired.%20If%20you%20create%20app%20through%20%2F_layouts%2F15%2Fappregnew.aspx%20it's%20expiry%20is%201%20year.%20If%20you%20want%20to%20increase%20expiry%20by%20more%20than%201%20year%20you%20can%20use%20the%20PowerShell%20script%20given%20in%20the%20below%20link.%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fprotect-us.mimecast.com%2Fs%2FYCuUCqxX5jhJjyqrTZIbnd%3Fdomain%3Ddocs.microsoft.com%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsharepoint%2Fdev%2Fsp-add-ins%2Freplace-an-expiring-client-secret-in-a-sharepoint-add-in%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESecondly%2C%20I%20have%20a%204.5%20framework%20console%20application%20and%20able%20to%20reproduce%20this%20issue%20on%20windows%20server%202012%20R2.%20Even%20after%20I%20get%20updated%20client%20Id%20and%20secret%20and%26nbsp%3B%20I%20changed%20the%20.Net%20framework%20to%204.6%2B%20or%204.7%20still%20able%20to%20reproduce%20this%20issue.%20So%20I%20have%20to%20have%20the%20following%20line%20of%20code%20before%20calling%20a%20method%20to%20get%20an%20access%20token.%3C%2FP%3E%3CP%3EServicePointManager.SecurityProtocol%20%3D%20SecurityProtocolType.Tls12%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20resolved%20my%20issue%20at%20least%20for%20now.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2428491%22%20slang%3D%22en-US%22%3ERe%3A%20Provider%20Hosted%20App%20(PHA)%20application%20errors%20(TLS%20errors%20and%20401%20errors).%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2428491%22%20slang%3D%22en-US%22%3E%3CP%3EYou%20don't%20need%20to%20hardcode%2C%20unless%20your%20executable%20is%20compiled%20with%20.NET%204.5.%20If%20you%20recompiled%20to%204.6%20or%204.7%20(you%20can't%20use%20the%20config%20file%20for%20this%2C%20you%20have%20to%20re-compile%20in%20VS)%20then%20the%20registry%20keys%20should%20work.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2300066%22%20slang%3D%22en-US%22%3ERe%3A%20Provider%20Hosted%20App%20(PHA)%20application%20errors%20(TLS%20errors%20and%20401%20errors).%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2300066%22%20slang%3D%22en-US%22%3E%3CP%3EYes.%20We%20have%20seen%20this%20would%20be%20both%20intermittent%20and%20constant.%20In%20the%20response%20body%20%22%3CSPAN%3EThe%20underlying%20connection%20was%20closed%3A%20An%20unexpected%20error%20occurred%20on%20a%20send.%3C%2FSPAN%3E%22%20is%20the%20most%20consistent%20message%20we%20have%20seen.%20We%20have%20also%20seen%20Tls%20stream%20error%20messages%20in%20the%20stack%20trace.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Co-Authors
Version history
Last update:
‎May 27 2021 02:37 PM
Updated by: