SignalR 2 Websockets with ASP.NET Core on .NET Framework

787 views Asked by At

I have an ASP.NET Core application, running on .NET Framework 4.6.2. I managed to run SignalR 2 by using owin-middleware. The issue is that it uses server events, instead of websockets. Is there any setup that can be done, in order to use websockets? enter image description here

In Startup.cs I am calling both app.UseWebSockets(); app.UseSignalR2() // custom extension method maps signalR to appbuilder

If specifying only webSockets transport, it doesn't have any errors, but it does not connect.

I have used a similar setup using a ASP.NET MVC project, and it worked as expected, this only reproduces when using ASP.NET Core on .NET Framework.

I found some similar posts, but I was not able to run it using websockets: Using SignalR on an asp.net Core app that targets the full .NET Framework

1

There are 1 answers

4
Camille Wintz On

This looks like it's missing the UseWebSockets method:

public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IServiceProvider serviceProvider)
{
        app.UseWebSockets();
}