olufikayo olowoyo
olufikayo olowoyo

Reputation: 37

using SignalR and angularjs on Asp.Net 4.0

I have resorted to asking this question here after ive searched Google for the last two day with no progress. Heres my challenge : I have an Asp.Net 4.0 application which uses Angularjs{I basically use only Html pages}. I need to integrate SignalR into the project for real time communication. I have googled and all i see is samples with .Net 4.5 above. I cannot use any of these as my service provider doesnt support .net 4.5 hence would not be able to host the application successfully.

My challenge lies on this line

[assembly: OwinStartupAttribute(typeof(SignalRwithAngular.Startup))]

when trying to setup a Startup class. as it complains

Error   18  The type or namespace name 'OwinStartupAttribute' could not be found (are you missing a using directive or an assembly reference?)  

I just need a sample of how to configure my angularjs controller to commincate with the Hub and how to setup the Startup class for .Net 4.0 Please note I cannot use .Net 4.5 as its not supported by my host.

Any useful link would be appreciated.

Upvotes: 0

Views: 426

Answers (2)

olufikayo olowoyo
olufikayo olowoyo

Reputation: 37

After much googling, i finally found a way out i totally removed

[assembly: OwinStartupAttribute(typeof(SignalRwithAngular.Startup))]

from the startup class

i installed the SignalR 1.1.4 package for .Net 4.0 via nuget

Install-Package Microsoft.AspNet.SignalR.Client -Version 1.1.4

in my Global.asax

 protected void Application_Start()
    {

        RouteTable.Routes.MapHubs();   // Must be added as the first line
         // Other Configs go here
    }

in my Startup.cs

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

}

and i confirmed it after building by navigating to

http://localhost:port/signalr/hubs

everything works fine now....

Upvotes: 1

UllaDieTrulla
UllaDieTrulla

Reputation: 573

Have you included Microsoft.Owin as a reference (via NuGet)?

Upvotes: 1

Related Questions