AunAun
AunAun

Reputation: 1453

SignalR 2 fails on Azure

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

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

fails with error 500.

The exception behind error 500 is this:

Exception Details: System.Security.Cryptography.CryptographicException: The data protection operation was unsuccessful. This may have been caused by not having the user profile loaded for the current thread's user context, which may be the case when the thread is impersonating.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding 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. This may have been caused by not having the user profile loaded for the current thread's user context, which may be the case when the thread is impersonating.]

I read and tried solution suggested at SignalR CryptographicException on AzureWebsites, but id didn't work for me.

As I understand, Azure doesn't allow LoadUserProfile.

Any workaround?

Upvotes: 5

Views: 837

Answers (1)

Cokes
Cokes

Reputation: 51

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

Upvotes: 3

Related Questions