Andrew Simpson
Andrew Simpson

Reputation: 7324

using SignalR in VS2010 with StartUp Error

I have a ASP.NET C# application.

I am targetting Framework 4.0.

I have this code:

using Microsoft.Owin;
using Owin;
using MyNameSpace;

[assembly: OwinStartup(typeof(MyNameSpace.Startup))]
namespace MyNameSpace
{
    public class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            app.MapSignalR();
        }
    }
}

I get this error:

The type or namespace name 'Owin' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

If i try to update using the nuGet package console I get this error message:

Could not install package 'Microsoft.Owin 3.0.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.0',

I have followed the advice to install a specific version of SignalR via the command line:

Install-Package Microsoft.AspNet.SignalR -Version 1.1.3

I am wondering if I can do this using Framework 4.0.

I would love to upgrade to framework 4.5.x but the server is Windows Web Server and will only support VS2010 which is limited to Framework 4.0.

What are my options?

Upvotes: 0

Views: 579

Answers (1)

I'mAguest
I'mAguest

Reputation: 26

Try to replace your code with these:

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

add the following on your Global.asax

 protected void Application_Start(object sender, EventArgs e)
        {
          RouteTable.Routes.MapHubs();
        }

Upvotes: 1

Related Questions