【问题标题】:SignalR - failed to process connectionToken - key not valid for use in specified stateSignalR - 无法处理 connectionToken - 密钥在指定状态下无效
【发布时间】:2016-11-23 12:26:04
【问题描述】:

我有使用 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 帐户启动的,如果这很重要的话

【问题讨论】:

  • 你在任何地方设置连接ID吗?
  • @AlexDresko 你的意思是在客户端?
  • @AlexDresko 在我们只读取的服务器上Context.ConnectionId
  • 您在多少台网络服务器上运行您的服务?
  • @bsoulier 问题出在我的开发机器上。所以只有一台网络服务器

标签: .net signalr system.security


【解决方案1】:

所以,问题是(至少在我们的例子中)SignalR 用于持久性的 Redis 服务器的缺失。在我们设置之后 - 问题就消失了。
不确定它是如何连接到机器密钥、网络农场和一般加密的

【讨论】:

    猜你喜欢
    • 2012-01-04
    • 1970-01-01
    • 1970-01-01
    • 2017-10-03
    • 1970-01-01
    • 1970-01-01
    • 2013-09-11
    • 2014-06-24
    • 1970-01-01
    相关资源
    最近更新 更多