question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Extra SignalR hubs in a Server-side Blazor app throw exceptions

See original GitHub issue

Describe the bug

In aspnetcore-preview-4, I can no longer use other SignalR Hubs at the same time as running Server-Side Blazor. My prev-3 project was running fine. When I completed the upgrade to prev-4, I could not get any clients to connect to the hub I have setup in UseEndpoints. The error message is always:

Error: Server returned handshake error: The protocol 'json' is not supported.

If I try to replace the AddNewtonsoftJsonProtocol with AddMessagePackProtocol, and setup my client to use MessagePack, the client says the messagepack protocol is not supported.

To Reproduce

Steps to reproduce the behavior:

  1. Using preview 4 of ASP.NET Core
  2. Create a default Server-side Blazor app (Razor Components template still)
  3. Add all the standard SignalR setup including AddNewtonsoftJsonProtocol
  4. Setup a client to connect to the hub and watch the error.

I’ve also got my source code here: https://github.com/limefrogyank/DynamicData/tree/master/DynamicData.SignalR.JSInterop.TestBlazorApp A javascript client attempted to connect (in wwwroot/dynamicDataSignalRInterop.js) when the Index.razor page is displayed. The call to the javascript file is deep, deep in the SignalRSourceCache class… but it was working fine in prev 3.

Expected behavior

The hub should connect (complete handshaking) and start passing data.

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Output of dotnet --info

.NET Core SDK (reflecting any global.json):
 Version:   3.0.100-preview4-011223
 Commit:    118dd862c8

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.18362
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\3.0.100-preview4-011223\

Host (useful for support):
  Version: 3.0.0-preview4-27615-11
  Commit:  ee54d4cbd2

.NET Core SDKs installed:
  2.1.202 [C:\Program Files\dotnet\sdk]
  2.1.402 [C:\Program Files\dotnet\sdk]
  2.1.403 [C:\Program Files\dotnet\sdk]
  2.1.500 [C:\Program Files\dotnet\sdk]
  2.1.502 [C:\Program Files\dotnet\sdk]
  2.1.504 [C:\Program Files\dotnet\sdk]
  2.1.600-preview-009426 [C:\Program Files\dotnet\sdk]
  2.1.600-preview-009472 [C:\Program Files\dotnet\sdk]
  2.1.600-preview-009497 [C:\Program Files\dotnet\sdk]
  2.1.600 [C:\Program Files\dotnet\sdk]
  2.1.601 [C:\Program Files\dotnet\sdk]
  2.1.602 [C:\Program Files\dotnet\sdk]
  2.1.700-preview-009597 [C:\Program Files\dotnet\sdk]
  2.2.101 [C:\Program Files\dotnet\sdk]
  3.0.100-preview4-011223 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.0.0-preview4-19216-03 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.0.0-preview4-27615-11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.0.0-preview4-27613-28 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
limefrogyankcommented, Apr 23, 2019

Thanks! Can confirm this works. It was giving me errors when I tried to change the options for all hubs under UseSignalR(options=>…)

1reaction
mikaelm12commented, Apr 22, 2019

We’ve figured out the issue and have a fix. There was an issue with how we were copying protocols across Hub and Hub<T>

Read more comments on GitHub >

github_iconTop Results From Across the Web

Extra SignalR hubs in a Server-side Blazor app throw ...
When I completed the upgrade to prev-4, I could not get any clients to connect to the hub I have setup in UseEndpoints...
Read more >
ASP.NET Core Blazor SignalR guidance
The following error is thrown by an app that hasn't enabled sticky ... with the app's Blazor Hub for scaling up a server-side...
Read more >
Use hubs in ASP.NET Core SignalR
HubException: An unexpected error occurred invoking 'SendMessage' on the server. Unexpected exceptions often contain sensitive information, such ...
Read more >
Blazor Server and SignalR and Azure AD
I want to show number of online users inside the app. I started using SignalR, but I am getting a very weird Error....
Read more >
Claims access with Blazor Server in SignalR Hub
My goal is to create SignalR groups based on a users claim for "DepartmentId" so all members of a department can have live...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found