18

I have a Web API project that uses SignalR which started giving me "unable to find Microsoft.AspNet.Signal.Core" errors frequently which were only fixed by doing a full rebuild in Visual Studio.

I upgraded SignalR and OWIN in Nuget to try and fix this issue, but now I always get "The following errors occurred while attempting to load the app. - No assembly found containing an OwinStartupAttribute. - No assembly found containing a Startup or [AssemblyName].Startup class"

I am the only person on my team to get this error - the same code works fine on other machines.

I have a Startup Class:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Microsoft.Owin;
using Owin;

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

I have tried adding the AppStartup key to the web.config too:

<add key="owin:appStartup" value="MyProject.Startup, MyProject" />

I have the following references in my WebApi project:

Microsoft.AspNet.SignalR.Core (2.1.0.0)
Microsoft.AspNet.SignalR.SystemWeb (2.1.0.0)
Microsoft.Owin (2.0.2.0)
Microsoft.Owin.Host.SystemWeb (2.0.2.0)
Microsoft.Owin.Security (2.0.2.0)
Owin (1.0.0)

I'm using IIS 8.5 on Windows 8 64Bit

SturmUndDrang
  • 1,876
  • 5
  • 27
  • 47

2 Answers2

33

I had this error during Identity Framework 2.0 integration. Adding Following in Web.config file of the project solved it:

<appSettings>
  <add key="owin:AutomaticAppStartup" value="false" />
</appSettings>
Yasser Shaikh
  • 46,934
  • 46
  • 204
  • 281
N_E
  • 743
  • 10
  • 16
3

It seems that Nuget didn't upgrade the SignalR dependencies properly (it must check that the version is in range and not bother updating) so 2 versions of the OWIN assemblies were being used in the solution.

So in the WebApi Project : SignalR 2.1.0 and Microsoft.Owin 2.0.2.0

and in another project : SignalR 2.1.0 and Microsoft.Owin 2.0.1.0

Visual Studio doesn't pick up the version incompatibilities on build either, so when the Web project loads up OWIN throws a nasty error (the Microsoft.Owin 2.0.1.0 assemblies were copied to the Web Project bin folder).

To fix I had to "update-package Microsoft.Owin -version 2.0.2.0" on the out-of-date project, clean and rebuild everything.

UPDATE:

Still getting the same problem. I assume now that it's some incompatibility issue between SignalR 2.1.0 and Owin 2.0.2.0.

SturmUndDrang
  • 1,876
  • 5
  • 27
  • 47