我有使用 Windows 应用程序托管的 SignalR 应用程序。长话短说,我知道,使用自托管更容易。
它工作正常 - 但是昨天,当我在 Visual Studio 的调试模式下运行它时,在连接尝试后我收到了 400 错误The ConnectionId is in the incorrect format.
。
我看了看日志——什么都没有。然后我启用了跟踪并发现了这个:
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)
任何想法如何解决它?
我看了谷歌一个小时——每个人都在谈论网络农场、证书存储和负载均衡器。我没有这些,我相信。
我在 Windows 7 上使用 .NET 4.5 和 SignalR 2.2.1。浏览器和 VS 都是从同一个 Windows 帐户启动的,如果这很重要的话