SignalR:"用户身份在主动SignalR连接期间无法更改"与windows auth网站出错

jhi*_*den 6 asp.net asp.net-mvc signalr

我有一个使用Windows身份验证运行signalR 2.1.0的MVC 5网站.因为我正在使用Windows身份验证登录/注销由IIS自动处理.偶尔我收到403错误,说"无法识别的用户身份.用户身份在活动的SignalR连接期间无法更改." 这不会一直发生,我似乎无法找到一个模式,它什么时候做不起作用.有人遇到过这种情况么?

以下是视图中的代码:

<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>
Run Code Online (Sandbox Code Playgroud)

任何帮助将不胜感激.

And*_*y V 5

我想我通过[Authorize]在Hub类中添加属性来解决此问题。仅仅几个小时,但是我用SignalR驱动的页面的运行情况要好得多。


cam*_*ior 3

对我有用的是在 IIS 设置中禁用匿名身份验证。