asp.net - SignalR 2 在 Azure 上失败

标签 asp.net azure signalr

我在 Azure 上部署了 ASP.NET 5 MVC 6 应用程序,并在使用 SignalR 2 时遇到了此问题: 当从客户端启动连接时,调用

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

失败并出现错误 500。

错误 500 背后的异常是这样的:

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.

来源错误:

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.

堆栈跟踪:

[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.]

我阅读并尝试了 SignalR CryptographicException on AzureWebsites 中建议的解决方案,但 id 对我不起作用。

据我了解,Azure 不允许 LoadUserProfile。

有什么解决办法吗?

最佳答案

我遇到了同样的问题,我的修复是在调用 MapSignalR() 之前添加对 UseAesDataProtectorProvider() 的调用。希望这对某人有帮助。

关于asp.net - SignalR 2 在 Azure 上失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36475209/

相关文章:

c# - 使用 C# 查找字符串?

azure - Azure 配置文件的自定义配置部分

asp.net-core - 让 SignalR IConnectionManager GetHubContext 在 aspnet 核心的 Startup.cs 中工作

c# - 使用 ViewRenderer 在 SignalR 响应中渲染 PartialView?

asp.net - .NET WebAPI 在本地主机上运行良好,但在 Azure 上不起作用

asp.net HttpContext.Current.Request.ServerVariables 不工作

c# - 更新数据库上的 ConnectionString 属性尚未初始化

c# - 更新到 MVC5 后找不到/signalr/hubs 404

c# - 地址的地理经度和地理纬度

java - 增加 Spring Cloud Stream Azure 服务总线中的并发调用未定义行为