Luke
Luke

Reputation: 527

SignalR Error 405 (method not allowed) - Negotiate

here below my envirovment:

We have some trouble with SignalR connection.

With the Attempt 1 we are able to use correctly signalR in our development environment (localhost), but when we deploy it in production we received the error:

"WebSocket connection to 'wss://xxxxxxxxx:60000/PushNotificationHub?access_token=' failed: Error during WebSocket handshake: Unexpected response code: 400"

Attempt 1

connessioneServizioChat = new signalR.HubConnectionBuilder().withUrl(puntatori.url.applicazioneApiCore + "PushNotificationHub", {
            accessTokenFactory: () => sicurezza.dati.tokenAutenticazioneWebApi,
            skipNegotiation: true,
            transport: signalR.HttpTransportType.WebSockets
        }).build();

So we are trying to avoid the "websocket" transport type with the solution below:

 connessioneServizioChat = new signalR.HubConnectionBuilder()
            .withUrl(puntatori.url.applicazioneApiCore + "PushNotificationHub")
            .configureLogging(signalR.LogLevel.Information)
            .build();

In this case we have an issue in the development environment too:

signalrNew.min.js:16 OPTIONS https://localhost:60000/PushNotificationHub/negotiate 405 (Method Not Allowed)

We don't understand WHAT is the negotiate method and how to solve our issue.

Can someone help us?

Thank you

Upvotes: 1

Views: 4248

Answers (1)

Luke
Luke

Reputation: 527

After 2 days we found the solution. The problem was the Server IIS. In our test server we had windows server 2008 with IIS 7.5. But IIS 7.5 doesn't support WebSocket because it was introduced with IIS 8.0.

Upvotes: 3

Related Questions