SignalR not working with Windows-integrated authentication

后端 未结 2 1377
悲&欢浪女
悲&欢浪女 2021-01-12 03:06

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-int

2条回答
  •  生来不讨喜
    2021-01-12 03:39

    Update from 2020: looks like Chrome now supports NTLM on WS-connections, not an issue any more


    ...10 hours later after asking the question...

    Partially solved (answering my own question)

    After playing with it I can confirm, that adding the [Authorize] attribute to my hub (or alternatively, adding GlobalHost.HubPipeline.RequireAuthentication(); to your "Startup.cs") actually does help. It does fall back now to an alternative transport, even though the error is still thrown into the browser's console.

    You can also specify which transport it falls back to, by calling:

    $.connection.hub.start( { transport: ['webSockets', 'longPolling'] });
    

    in case you don't like the default priority (I guess, "hidden iframe" is the default second option).

    The reason

    The error is caused by Chrome, it does not support NTLM on websocket connections. Funny enough, IE, MS Edge and Firefox do support it ("Chrome is the new IE" huh).

    There's an open issue in Chromium bugtracker for this here https://bugs.chromium.org/p/chromium/issues/detail?id=423609 if anyone wants to add any input to Chromium devs.

提交回复
热议问题