I’ve been working with Umbraco quite a bit lately and one thing I kept running into on one of my machines is it just wouldn’t let me install any packages. This became quite a hinderance so I finally dug into it.
I started off by digging through the logs at /App_Data/logs/ and found this error:
'{RequestUrl}'","@l":"Error","@x":"System.Net.Http.HttpRequestException: An error occurring downloading the package from https://our.umbraco.com/webapi/packages/v1/ced954d1-8c0f-4abe-bdda-99e7a787d052?version=8.14.0&includeHidden=true&asFile=true ---> 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.\r\n at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)\r\n at System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar)\r\n --- End of inner exception stack trace ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n
The full stack trace is much bigger but the key piece is at the start, a SSL/TSL error. Initially I thought this was because I was running on HTTP and not HTTPS, after switching over I saw that wasn’t the case. The solution in the end was to add the following to my Global.ascx.cs file:
<script runat="server">
void Session_Start(object sender, EventArgs e)
{
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;
}
</script>
From there I stopped and restated the projet in Visual Studio in order to recycle IIS Express. After that I attempted to install a package and finally I was able to without any errors!