You*_*bos 5 asp.net-mvc signalr-2 azure-signalr
我从 2.4.0 更新了我们的信号器包并添加RunAzureSignalR了RunSignalR. 在 de 中添加了此代码Startup.cs
app.Map("/signalr", map =>
{
var hubConfiguration = new HubConfiguration
{
EnableDetailedErrors = true
};
map.RunAzureSignalR(typeof(Startup).FullName, hubConfiguration, options =>
{
options.ConnectionString = AppApiSettings.SignalRServiceConnectionString;
});
});
Run Code Online (Sandbox Code Playgroud)
但是,当我尝试向集线器发送消息时,出现异常The connection is not active, data cannot be sent to the service.。找不到任何原因会发生这种情况或服务无法运行的原因。
当我使用 RunSignalR(自托管)时,一切运行良好。
任何帮助将不胜感激。
事实证明,出于安全考虑,Azure 服务仅支持 TLS1.2。请将以下代码添加到您的启动中:
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
Run Code Online (Sandbox Code Playgroud)
此解决方案的提示可以在 github 票证上找到:https://github.com/Azure/azure-signalr/issues/279
“无可用服务器”表示您的应用服务器在连接到 Azure 服务时遇到问题。您可以使用以下命令从应用程序服务器端启用跟踪,以查看是否抛出任何错误。
GlobalHost.TraceManager.Switch.Level = SourceLevels.Information;
Run Code Online (Sandbox Code Playgroud)
此处的示例: https: //github.com/Azure/azure-signalr/blob/dev/samples/AspNet.ChatSample/AspNet.ChatSample.SelfHostServer/Startup.cs#L19
如果您在本地调试服务器端,您还可以取消选中“Just My Code”,并在任何 CLR 异常抛出时中断:
System.Security.Authentication.AuthenticationException:“对 SSPI 的调用失败,请参阅内部异常。” -(内部)“不支持请求的功能”
System.ObjectDisposeException:“安全句柄已关闭”
System.Net.WebException:“请求已中止:无法创建 SSL/TLS 安全通道。”
System.Net.WebSockets.WebSocketException:“无法连接到远程服务器”-(内部)WebException:请求已中止:无法创建 SSL/TLS 安全通道。
| 归档时间: |
|
| 查看次数: |
1392 次 |
| 最近记录: |