Can I use SignalR 2.2 in an ASP5 vNext (beta8) application?

According to the ASP.Net 5 roadmap, SignalR 3 will not go into RTM. https://github.com/aspnet/Home/wiki/Roadmap

Is it possible to use SignalR 2.2 in a vNext project? How do i call MapSignalR()? The Configure method in Startup.cs has an IApplicationBuilder, but the extension method for SignalR wants to be called in IAppBuilder, maybe it has a second Startup class? How can I configure this?

+4
source share
2 answers

Like RC1, see the IAppBuilderBridge sample to get SignalR 2.2 to work with RC1. You just take a class KatanaIApplicationBuilderExtensionsfrom this project, and then add signalR to the class Startupas follows:

app.UseAppBuilder(
  appBuilder =>
  {
      appBuilder.MapSignalR();
  });

I added it after UseMvc.

Just tested myself on a new MVC project on RC1 and in IIS Express. At least the Tutorial sample works fine. And as Todd Sprang noted in a comment, it should work because it does not depend heavily on higher-level ASP.NET components.

See also this blog post .

+4
source

Just create this class in the App_Start folder and change it to your liking.

[assembly: OwinStartup(typeof(SignalRStartup))]

namespace Comp.Prod.Web
{
    public class SignalRStartup
    {
        public void Configuration(IAppBuilder app)
        {
            try
            {
                var hubConfig = new HubConfiguration
                {
#if DEBUG
                    EnableDetailedErrors = true
#else
                EnableDetailedErrors = false
#endif
                };

                GlobalHost.DependencyResolver.UseSqlServer(Settings.Default.BackplaneConnectionString);

                app.MapSignalR(hubConfig);

                GlobalHost.HubPipeline.RequireAuthentication();
            }
            catch (Exception e)
            {
                Debug.WriteLine("Following exception thrown from SignalRStartup:");
                Debug.WriteLine(e);
            }
        }
    }
}
0
source

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


All Articles