Using SignalR 2 in an ASP.NET 5 Application

SignalR 3 and ASP.NET 5 worked just fine before beta7. Microsoft is now declaring that SignalR 3 is “on hold,” and you should not expect the two to work together in the near future:

https://github.com/aspnet/SignalR-Server/issues/119

https://github.com/aspnet/SignalR-Server/issues/121

So the question is: is there any way to make at least SignalR 2 work in an ASP.NET 5 application?

+5
source share
2 answers

Found a common solution for using owin-compatible middleware in this article: https://lbadri.wordpress.com/2014/11/01/asp-net-vnext-middleware-versus-owinkatana-middleware/

  • Link to Microsoft.AspNet.Owin
  • Paste the following code into Startup.Configure :
 app.UseOwin(addToPipeline => { addToPipeline(next => { var appBuilder = new AppBuilder(); appBuilder.Properties["builder.DefaultApp"] = next; appBuilder.MapSignalR(); return appBuilder.Build<AppFunc>(); }); }); 
+7
source

SignalR 2 also works on .NET Core 2 when you scrap inside yourself:

 // SignalR checks if it running in a Mono environment and then // disables features like performance counters // .NET Core isn't Mono, but doesn't have the performance counters DLL // Let make .NET Core a Mono var signalRAssembly = typeof(Microsoft.AspNet.SignalR.PersistentConnection).Assembly; // This type is internal var monoUtility = signalRAssembly.GetType("Microsoft.AspNet.SignalR.Infrastructure.MonoUtility"); var field = monoUtility.GetField( "_isRunningMono", BindingFlags.NonPublic | BindingFlags.Static ); field.SetValue(null, new System.Lazy<bool>(() => true)); 
0
source

Source: https://habr.com/ru/post/1232726/


All Articles