As said in the SignalR differences documentation we can use SignalR Core on .NET 4.6.1 and latter...
So I know the code for the startup and configuration for both cases:
SignalR Core:
ConfigureServices
//Add SignalR service
services.AddSignalR();
Startup
app.UseSignalR(routes =>
{
routes.MapHub<NotificationsHub>("/notification");
});
SignalR:
Startup
app.Map("/signalr", map =>
{
map.UseCors(CorsOptions.AllowAll);
var hubConfiguration = new HubConfiguration { };
hubConfiguration.EnableDetailedErrors = true;
map.RunSignalR(hubConfiguration);
});
And my question is, what I need to do in the .NET 4.6.1 startup to map my SignalR hub and etc...? I can't find any documentation about this particular case.
Update1: I tried to run the same code and obviously changed the client code to use the SignalR core approach and what I get now is (not authorized) during negotiation request.
After some research and after I asked this same question on the ASP.NET forum, I came to the result of that it is not possible to use SignalR Core on any .NET Framework project. We can use it only on .NET Core projects and it supports targeting framework to .NET Framework 4.6.1 or later then compile and run the application on supported platform.
More details here: https://forums.asp.net/t/2160460.aspx
While this question was already answered by the OP I think a more complete answer is warranted for the benefit of others who may stumble across it.
ASP.NET Core versions 1 through 2.2 supported targetting .NET Framework v4.6.1+ to ease transitioning from ASP.NET v4 to ASP.NET Core. This support was dropped in ASP.NET Core v3.
While both SignalR and SignalR Core have nuget packages targetting .NET Framework v4.6.1+ they have different dependencies. This is made slightly more confusing due to one of the SignalR nuget packages being called Microsoft.AspNet.SignalR.Core.
The long and short of it is SignalR Core was built upon ASP.NET Core. You cannot use SignalR Core without it. If you want to use SignalR Core while still targetting .NET Framework v4.6.1-v4.8 you can do so only by creating a ASP.NET Core v1-v2.2 project then changing it's target framework to .v4.6.1-v4.8.
For ASP.NET v4 applications as of this writing the latest supported version of SignalR is v2.4.3.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With