0

I have SignalR application hosted using Windows app. Long story, easier with selfhosting, I know.
It was working fine - but yesterday, when I run it in Debug mode in Visual Studio, after connection attempt I got an 400 error back The ConnectionId is in the incorrect format..
I looked at the logs - nothing. Then I enabled tracing and found this:

SignalR.HubDispatcher Information: 0 : Failed to process connectionToken: System.Security.Cryptography.CryptographicException: Key not valid for use in specified state.

   at System.Security.Cryptography.ProtectedData.Unprotect(Byte[] encryptedData, Byte[] optionalEntropy, DataProtectionScope scope)
   at System.Security.Cryptography.DpapiDataProtector.ProviderUnprotect(Byte[] encryptedData)
   at System.Security.Cryptography.DataProtector.Unprotect(Byte[] encryptedData)
   at Microsoft.Owin.Security.DataProtection.DpapiDataProtector.Unprotect(Byte[] protectedData)
   at Microsoft.AspNet.SignalR.Infrastructure.DataProtectionProviderProtectedData.Unprotect(String protectedValue, String purpose)
   at Microsoft.AspNet.SignalR.PersistentConnection.TryGetConnectionId(HostContext context, String connectionToken, String& connectionId, String& message, Int32& statusCode)

Any ideas how to fix it?
I looked at google for an hour - everybody is talking about web farms, certificate stores and load balancers. I don't have any of that, I believe.
I use .NET 4.5 with SignalR 2.2.1 on Windows 7. Both browser and VS are launched from the same Windows account, if that matters

chester89
  • 8,328
  • 17
  • 68
  • 113

1 Answers1

0

So, it turns out the issue was (at least in our case) the absense of Redis server which SignalR uses for persistence. After we set it up - the problem went away.
Not sure how's that connected to machine keys, web farms and encryption in general

chester89
  • 8,328
  • 17
  • 68
  • 113