SignalR:"用户身份不能主动SignalR连接&QUOT期间更改;误差Windows验证网站 [英] SignalR: "The user identity cannot change during an active SignalR connection" error with windows auth website

查看:925
本文介绍了SignalR:"用户身份不能主动SignalR连接&QUOT期间更改;误差Windows验证网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个MVC 5网站使用Windows身份验证运行signalR 2.1.0。因为我使用Windows身份验证登录/注销由IIS自动处理。偶尔我得到一个403错误说无法识别用户身份,用户身份不能主动SignalR连接过程中发生改变。这不会发生的时候,我似乎无法找到当它不工作到一个模式。有没有其他人遇到这个?

I have an MVC 5 website running signalR 2.1.0 using Windows Authentication. Because I'm using windows auth login/logout is handled automatically by IIS. Occassionally I'm getting a 403 error saying "Unrecognized user identity. The user identity cannot change during an active SignalR connection." This doesn't happen all the time, and I can't seem to find a pattern to when it does and does not work. Has anyone else encountered this?

下面是视图上的code:

Here is the code on the view:

<script type="text/javascript">
        $(document).ready(function() {
            SignalRSetup();
        });

        function SignalRSetup() {
            // Declare a proxy to reference the hub.
            var hub = $.connection.tokenRequestHub;

            // Create a function that the hub can call to broadcast messages.
            hub.client.updateFromService = function(tokenRequestID, message, success) {
                var msg = "Token Request ID {0} => {1}".format(tokenRequestID, message);
                var notyType = (success) ? 'success' : 'error';
                noty({ text: msg, type: notyType, timeout: 2000 });
                if (success) {
                    refreshGrids();
                }
            };

            $.connection.hub.start();//this is where it errors!
        }
</script>

任何帮助将大大AP preciated。

Any help would be greatly appreciated.

推荐答案

什么工作对我来说是在IIS设置来禁用匿名身份验证。

What worked for me was to disable Anonymous Authentication in the IIS settings.

这篇关于SignalR:&QUOT;用户身份不能主动SignalR连接&QUOT期间更改;误差Windows验证网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆