I have an ASP.NET MVC 4 app (.NET 4.5) and SIgnalR works fine with forms-based authentication (hosted via IIS/IIS Express)
As soon as I change the app to windows-integrated authentication (<authentication mode="Windows"/>
in "web.config") it stops working.
jquery.signalR-2.2.2.min.js:9 WebSocket connection to
ws://localhost:51030/signalr/connect?transport=webSockets&blhablahblah
failed: Error during WebSocket handshake: Unexpected response code: 403
After adding the [Authorize]
attribute to my hub, the error changes to
WebSocket connection to
ws://localhost:51030/signalr/connect?transport=webSocketsblahblah
failed: HTTP Authentication failed; no valid credentials available
Other parts of the app are working just fine, windows-auth is enabled on the server and works, etc. etc.
How do I solve this?
And if it is unsolvable for some reason (it could be Chrome not supporting windows auth on websocket connections or something else) - why doesn't it fall back to non-websocket protocol? and how do I force the fallback?
UPDATE: I created a github issue https://github.com/SignalR/SignalR/issues/3953. The problem is not that I can't connect. The problem is that I cannot handle the error to fall back to another transport. Neither .fail()
not .error()
are being invoked. Try-catch doesn't help either.