2016-07-03 99 views
8

我有signalR的WebSocket显示通知未能在WebSocket的握手代码连接signalR错误:400

代码连接,如:部署到生产服务器signalR后

$.connection.hub.start().done(function(){ 
    console.log("connected"); 
}); 

var notif = $.connection.notificationHub; 
console.log(notif); 

不能正常工作,并显示这个错误在控制台: console errpr

生产服务器使用的是IIS 8.5 是什么让这个错误?谢谢。

+1

[SignalR:WebSocket握手期间的错误:意外的响应代码:400]的可能的重复(http://stackoverflow.com/questions/23130152/signalr-error-during-websocket-handshake-unexpected-response-code-400 ) –

+0

你在使用.netcore吗? – jeanfrg

回答

1

您在<system.web>标记内您的web.config文件中是否有此标签?

<httpRuntime maxRequestLength="40960" targetFramework="4.5" requestValidationMode="2.0" /> 

如果不行尝试故障转移到long polling,而不是WebSocketsSignalR,看看你得到同样的错误。

+0

这对我有用,但无法想象为什么。你有什么想法吗?我发现在signalr中引擎下尝试解析请求认证令牌并失败,但无法获得更多详细信息 –

相关问题