I have decided to revise this question as it was a rush job after hours of frustration. Apologies to all that wasted time on it.
Topology: Two distinct application. 1. WPF Application C#. Includes DevExpress tools, SignalR, AutoRest implemation of web api. ADAL authenication. 2. Webapi ASP.NET that resides on Azure, recently upgraded to .net version 4.6.1 (Post errors). I use versioning also via headers. 3.Azure SQL Server as the backend. Recently upgraded DTU (Memory, CPU etc) from 10 to 20. (Post errors)
System has been running successfully for approx three years, with a lot of development work over that period.
After no releases for several days, Monday morning comes and errors start appearing. I log all errors to SQL Server via NLog.
First Error: (By far the most I am getting)
System.Net.Http.HttpRequestException: Error while copying content to a stream. ---> System.IO.IOException: The decryption operation failed, see inner exception. ---> System.ComponentModel.Win32Exception: The specified data could not be decrypted
then I started seeing
System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: The request was aborted: Could not create SSL/TLS secure channel.
at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar)
--- End of inner exception stack trace ---
This error is less frequent, but happened 8 times yesterday.
Also I am seeing this error, which today I am starting to think may be the main culprit. I will be looking closely at my ADAL call, thought this has been working fine.
Microsoft.Rest.HttpOperationException: Operation returned an invalid status code 'Unauthorized'
The errors appear randomly, you can bypass them, and the system continues to work. Quite often there is a requirement to refresh the data.
I have since rebuilt the api from an earlier version that I know was stable, and adding in the few calls I have created since. I rebuilt the WPF app yesterday, and then had the same outcome.
So I started to think it was infrastructure on Azure.
I upgraded the DTU's on SQL Server (That was topping out, and was needed).
I upgrade the API web service plan to the next level.
I set mimimum TLS on the api to 1.2 via Azure. No changes on the api code, I just don't know enought about how TLS works.
I now have application insights running on azure, to see how the web api is running and see if I can spot anything.
I am still seeing the errors this morning. Its been a long week!