SignalR 2 does not work on Azure

I deployed an ASP.NET 5 MVC 6 application on Azure and ran into this problem with SignalR 2: when starting a connection from a client, call

/signalr/negotiate?clientProtocol=1.5&connectionData=%5B%7B"name"%3A"gameHub"%7D%5D&_=1460028930688 

with a 500 error.

The exception to error 500 is the following:

Exception Details: System.Security.Cryptography.CryptographicException: Data protection was unsuccessful. Perhaps this was caused by not having a user profile loaded for the current thread user context, which may occur when the thread personifies itself.

Source Error:

An unhandled exception was thrown during the execution of the current web request. Information about the origin and location of the exception can be identified using the exception stack trace below.

Stack trace:

[CryptographicException: The data protection operation was unsuccessful. Perhaps this was due to the absence of the user profile loaded for the current context of the thread user, which may be when the thread gives itself out.]

I read and tried the solution proposed in SignalR CryptographicException on AzureWebsites , but id did not work for me.

As I understand it, Azure does not allow LoadUserProfile.

Any workaround?

+5
source share
1 answer

I had the same problem and I decided to add a call to UseAesDataProtectorProvider() before my call to MapSignalR() . Hope this helps someone.

+3
source

Source: https://habr.com/ru/post/1246627/


All Articles