Closed TheOfficialLoren closed 3 years ago
After posting this, I found this article announcing a TLS update on Dec 31 2020:
https://docs.microsoft.com/en-us/azure/notification-hubs/notification-hubs-tls12
And another bug report in this github had a user suggesting adding this line: System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
I added this line right before I instantiate the Notification Hub.
This resolved my issues.
Thank you @TheOfficialLoren - same problem, same fix.
@TheOfficialLoren TLS 1.2 is the only supported protocol for Notification Hubs.
Describe the bug When sending a notification I receive an exception: Could not create SSL/TLS secure channel
Exception or Stack Trace
Microsoft.Azure.NotificationHubs.Messaging.MessagingException: Unexpected exception encountered TrackingId:c03e475f-c91d-4ec7-bcc1-3374c938738a,TimeStamp:2021-01-14T22:19:33.5028410Z ---> 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.EndGetRequestStream(IAsyncResult asyncResult, TransportContext& context) at System.Net.Http.HttpClientHandler.GetRequestStreamCallback(IAsyncResult ar) --- End of inner exception stack trace --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Azure.NotificationHubs.NotificationHubClient.d201.MoveNext()
--- End of inner exception stack trace ---
at Microsoft.Azure.NotificationHubs.ExceptionsUtility.HandleUnexpectedException(Exception ex, String trackingId)
at Microsoft.Azure.NotificationHubs.NotificationHubClient.d 201.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.NotificationHubs.NotificationHubClient.<>c__DisplayClass189_0.<b0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.NotificationHubs.NotificationHubRetryPolicy.d 4d189.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at I1.Service.NotificationService.d 5.MoveNext() in C:\Users\loren\dev\ai\Application\Service\I1.Service\NotificationService.cs:line 44
1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.Azure.NotificationHubs.NotificationHubRetryPolicy.<RunOperation>d__4
1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Azure.NotificationHubs.NotificationHubClient.To Reproduce
Just send a notification using the code below. Use connection string from Azure Portal -> NotificationHubNamespace -> Access Policies Use notificationHubPath found in Azure Portal -> Notification Hub
Code Snippet
Expected behavior Message gets sent
Screenshots If applicable, add screenshots to help explain your problem.
Setup (please complete the following information): .Net Framework
Additional context
Information Checklist Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report