Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SignalR without OWIN

I'm participating in the ASP MVC project.

I want to use SignalR in the project but I don't want to use OWIN lib.

As I understand, SignalR is registered in the application using this piece of code:

public class Startup
{
    public void Configuration(IAppBuilder app)
    {
        app.MapSignalR();
    }
}

How can I modify this to remove the dependency to OWIN?

I would like to use approach similar to RouteConfig.RegisterRoutes(RouteTable.Routes);

like image 255
nZeus Avatar asked Oct 09 '14 08:10

nZeus


2 Answers

If you don't want the owin lib you can use SignalR 1.x.

protected void Application_Start()
{
    RouteTable.Routes.MapHubs();
}
like image 142
Aravind Sivam Avatar answered Sep 21 '22 13:09

Aravind Sivam


First be sure to Get-Package within the Package Manager Console and remove all previous installments Uninstall-Package [Id] -RemoveDependencies as this should give you a clean slate.

What worked for me without assembly nor dependency issues was using NuGet to install Microsoft.AspNet.SignalR Version 1.1.4 into your App and DataAccess. Then add the following to your Global.asax file:

// Add this Library for MapHubs extension
using System.Web.Routing;

protected void Application_Start()
{
// This registers the default hubs route: ~signalr
// Simply add the line below WITHIN this function
RouteTable.Routes.MapHubs();
}

[Did this using Visual Studios 2015 Enterprise on 10/29/2015]

like image 30
John O. Morales-Marquez Avatar answered Sep 24 '22 13:09

John O. Morales-Marquez