0
votes

I've created a new MVC5 asp.net website with SignalR (v2.1.1.0) The SignalR part is hosted inside the web application.

I've added a new Hub : MainHub.cs

using BackEnd.Models;
using BackEnd.Utils;
using Microsoft.AspNet.SignalR;
using Microsoft.Practices.Unity;

namespace BackEnd.Hubs
{
    public class MainHub : Hub
    {

            // Code
    }
}

Then I've added a new StartUp file by doing a right click on the project -> add new 'OWIN Statup class' and named it 'Startup.cs' :

using Microsoft.Owin;
using Owin;

[assembly: OwinStartup(typeof(BackEnd.Startup))]
namespace BackEnd
{
    public class Startup
    {
        public static Configs.ContainerInjection container;

        public void Configuration(IAppBuilder app)
        {
            container = new Configs.ContainerInjection();
            container.Configure();
            app.MapSignalR();
        }
    }
}

And this is my config file : Web.config

<appSettings>
  <add key="owin:AutomaticAppStartup" value="true" />
  <add key="webpages:Version" value="3.0.0.0" />
  <add key="webpages:Enabled" value="false" />
  <add key="ClientValidationEnabled" value="true" />
  <add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
...
<system.web>
    <compilation debug="true" targetFramework="4.5.1" />
    <httpRuntime targetFramework="4.5.1" />
  </system.web>

But when I launch the application on Local IIS, the 'Configuration' method is not called inside the Startup file. But it does work when launched on IIS Express (localhost:3405)

I use 'DefaultApp Pool' with Framework v4.0 and Integrated Pipeline mode and 'Microsoft.Owin.Host.SystemWeb' is correctly placed in the '/bin' folder.

Is there anything I've done wrong ?

2

2 Answers

3
votes

Install SystemWeb host and you will be fine.

Install-Package Microsoft.Owin.Host.SystemWeb

This installs a httphandler to call the starup.

0
votes

The OwinStartupAttribute is in the Microsoft.Owin.dll. Do you have this in your bin folder? What other Owin dlls do you have in the application bin folder?