【问题标题】:SignalR Error 405 (method not allowed) - NegotiateSignalR 错误 405(不允许的方法) - 协商
【发布时间】: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


    【解决方案1】:

    2 天后,我们找到了解决方案。 问题是服务器 IIS。 在我们的测试服务器中,我们有带有 IIS 7.5 的 windows server 2008。但是 IIS 7.5 不支持WebSocket because it was introduced with IIS 8.0.

    【讨论】:

      猜你喜欢
      • 2017-11-13
      • 1970-01-01
      • 2021-12-20
      • 2016-12-02
      • 2015-11-25
      • 2012-10-25
      • 2012-03-21
      • 1970-01-01
      • 2014-10-04
      相关资源
      最近更新 更多