9

i have signalR websocket to show notification

the code for connecting like :

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

after deploying to a production server signalR is not working and showing this error in console : console errpr

production server is using iis 8.5 what makes this error? thank you.

Community
  • 1
  • 1
Mamen
  • 1,322
  • 5
  • 21
  • 44
  • 1
    Possible duplicate of [SignalR: Error during WebSocket handshake: Unexpected response code: 400](http://stackoverflow.com/questions/23130152/signalr-error-during-websocket-handshake-unexpected-response-code-400) – Saurabh Srivastava Nov 07 '16 at 04:14
  • Are you using .netcore? – jeanfrg Jul 27 '17 at 13:06

1 Answers1

1

Do you have this tag in your web.config file within the <system.web> tag?

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

If that doesn't work try failing over to long polling instead of WebSockets in SignalR and see if you get the same error.

jeanfrg
  • 2,366
  • 2
  • 29
  • 40
  • this works for me, but could not imagine why. Do you have any thoughts what is going there? I've found that under the hood middleware with signalr try to parse request auth token and failed but could not get more details – Vladimir Shmidt Feb 08 '18 at 15:15
  • While I do not know how this solution manages to avoid the response error code 400, it does at least prevent “connection reset” errors for several people. See the https://stackoverflow.com/a/37531108/2416627 thread. – Otto G Aug 01 '18 at 14:28
  • it's still valid also for .net core? – Luke Apr 30 '19 at 14:36