profile
viewpoint

Ask questionsError: Server returned handshake error: Handshake was canceled.

  1. Followed instructions in creating a SignalR project in .NET Core 2.2 https://docs.microsoft.com/en-us/aspnet/core/tutorials/signalr?view=aspnetcore-2.2&tabs=visual-studio
  2. Everything works on local IIS Express -- Windows 7, Visual Studio 2019
  3. Published to server, Windows 2008R2, IIS 7.5
  4. URL is HTTPS -- https://dw.example.com
  5. Added Debug logic in both client (configureLogging(signalR.LogLevel.Trace)) and server ("Microsoft.AspNetCore.SignalR": "Debug", "Microsoft.AspNetCore.Http.Connections": "Debug")

Using Chrome Dev Tools (FYI - IE11 has same thing); console output: Information: Normalizing '/chatHub' to 'https://dw.example.com/chatHub'. signalr.js:2440 Debug: Starting HubConnection. signalr.js:2440 Debug: Starting connection with transfer format 'Text'. signalr.js:2440 Debug: Sending negotiation request: https://dw.example.com/chatHub/negotiate signalr.js:2440 Debug: Selecting transport 'ServerSentEvents' signalr.js:2440 Trace: (SSE transport) Connecting signalr.js:2436 Information: SSE connected to https://dw.example.com/chatHub?id=MoeAzDS7OtmeAylCN_vQEA signalr.js:2440 Debug: Sending handshake request. signalr.js:2440 Trace: (SSE transport) sending data. String data of length 32. signalr.js:1624 POST https://dw.example.com/chatHub?id=MoeAzDS7OtmeAylCN_vQEA 404 (Not Found) (anonymous) @ signalr.js:1624 DefaultHttpClient.send @ signalr.js:1583 HttpClient.post @ signalr.js:1563 (anonymous) @ signalr.js:2342 step @ signalr.js:2273 (anonymous) @ signalr.js:2254 fulfilled @ signalr.js:2245 Promise.then (async) step @ signalr.js:2247 (anonymous) @ signalr.js:2248 __awaiter @ signalr.js:2244 sendMessage @ signalr.js:2329 (anonymous) @ signalr.js:3452 step @ signalr.js:3364 (anonymous) @ signalr.js:3345 (anonymous) @ signalr.js:3339 __awaiter @ signalr.js:3335 ServerSentEventsTransport.send @ signalr.js:3447 HttpConnection.send @ signalr.js:2648 (anonymous) @ signalr.js:1765 step @ signalr.js:1708 (anonymous) @ signalr.js:1689 fulfilled @ signalr.js:1680 Promise.then (async) step @ signalr.js:1682 (anonymous) @ signalr.js:1683 __awaiter @ signalr.js:1679 HubConnection.start @ signalr.js:1750 (anonymous) @ chat.js:16 chat.js:19 Error: Not Found (anonymous) @ chat.js:19 Promise.catch (async) (anonymous) @ chat.js:18 signalr.js:2440 Trace: (SSE transport) data received. String data of length 36. signalr.js:2430 Error: Server returned handshake error: Handshake was canceled. ConsoleLogger.log @ signalr.js:2430 HubConnection.processHandshakeResponse @ signalr.js:2006 HubConnection.processIncomingData @ signalr.js:1948 HubConnection.connection.onreceive @ signalr.js:1730 eventSource.onmessage @ signalr.js:3412 signalr.js:2430 Error: Connection disconnected with error 'Error: Server returned handshake error: Handshake was canceled.'.

I used .NET Framework SignalR with no issues. Only issue is .NET Core SignalR.

Thanks!

aspnet/AspNetCore

Answer questions BrennanConroy

Could you provide the server logs? It would be useful to see what they say and if they match what the client is observing.

Another thing you could try is using the LongPolling transport instead of ServerSentEvents and see if you get a similar issue.

useful!

Related questions

HTTP Error 500.31 - ANCM Failed to Find Native Dependencies hot 123
The SPA default page middleware could not return the default page '/index.html' in production application hot 102
The SPA default page middleware could not return the default page '/index.html' in production application hot 96
Asp.Net MVC Core: “Error unprotecting the session cookie” exception hot 79
No DefaultChallengeScheme found from preview8 to preview9 hot 67
BadHttpRequestException: Reading the request body timed out due to data arriving too slowly hot 65
Method not found: 'Microsoft.EntityFrameworkCore.Metadata.Builders.IndexBuilder Microsoft.EntityFrameworkCore.Metadata.Builders.EntityTypeBuilder`1.HasIndex(System.Linq.Expressions.Expression`1<System.Func`2<System.__Canon,System.Object>>)'. hot 59
The library &#39;hostpolicy.dll&#39; required to execute the application was not found - AspNetCore hot 58
error CS1503: Argument 2: cannot convert from 'method group' to 'EventCallback' hot 57
Error: Invocation canceled due to the underlying connection being closed. hot 54
Unexpected end of request content k8s pod - AspNetCore hot 53
Using 'UseMvc' to configure MVC is not supported while using Endpoint Routing. To continue using 'UseMvc', please set 'MvcOptions.EnableEndpointRounting = false' inside 'ConfigureServices'. hot 50
IIS in-process hosting incorrectly throws ConnectionResetException for HTTP POST hot 47
HTTP Error 500.30 - ANCM In-Process Start Failure hot 43
Issue with BuildServiceProvider() in ConfigureServices() hot 42
source:https://uonfu.com/
answerer
Brennan BrennanConroy Developer on ASP.NET Core. SignalR all the things.
Github User Rank List