【发布时间】:2019-09-19 08:54:14
【问题描述】:
在我的环境下方:
- 带有 Mvc .NetCore 2.2 的 Web 客户端 Javascript
- Web api .Net Core 2.2 中的 WebAPI
- 带有 openid 的 AzureAd 身份验证
SignalR 连接出现问题。
通过尝试1,我们能够在我们的开发环境(本地主机)中正确使用signalR,但是当我们在生产环境中部署它时,我们收到了错误:
“到 'wss://xxxxxxxxx:60000/PushNotificationHub?access_token=' 的 WebSocket 连接失败:WebSocket 握手期间出错:意外响应代码:400”
尝试 1
connessioneServizioChat = new signalR.HubConnectionBuilder().withUrl(puntatori.url.applicazioneApiCore + "PushNotificationHub", {
accessTokenFactory: () => sicurezza.dati.tokenAutenticazioneWebApi,
skipNegotiation: true,
transport: signalR.HttpTransportType.WebSockets
}).build();
所以我们试图通过以下解决方案避免“websocket”传输类型:
connessioneServizioChat = new signalR.HubConnectionBuilder()
.withUrl(puntatori.url.applicazioneApiCore + "PushNotificationHub")
.configureLogging(signalR.LogLevel.Information)
.build();
在这种情况下,我们在开发环境中也存在问题:
signalrNew.min.js:16 OPTIONS https://localhost:60000/PushNotificationHub/negotiate 405(不允许的方法)
我们不明白什么是协商方法以及如何解决我们的问题。
有人可以帮助我们吗?
谢谢
【问题讨论】:
标签: asp.net-core signalr azure-active-directory asp.net-core-2.2