2016-07-03 97 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中引擎下嘗試解析請求認證令牌並失敗,但無法獲得更多詳細信息 –

相關問題