I\'m getting this error as my project is not able to find the reference for OWIN
startup class. I\'ve even installed all the OWIN reference packages through Nug
Have a look for the Startup.cs
file, you might be missing one of these. This file is the entry point for OWIN, so it sounds like this is missing. Take a look at OWIN Startup class here to understand whats going on.
As your error specifies, you can disable this in the web.config by doing the following...
To disable OWIN startup discovery, add the appSetting owin:AutomaticAppStartup with a value of "false" in your web.config
Just check that your packages.config
file is checked in (when excluded, there will be a red no-entry symbol shown in the explorer). For some bizarre reason mine was excluded and caused this issue.
My case? I had startup file, but it is excluded in the project. I just included it and the error left.
While I can't fully explain why this solved the issue for me, I ran into a problem like this after I changed my API project to build to separate \debug
and \release
folders. Once I reverted that change back to build to a single \bin
folder things started working.
I wrote up my experience here: Can't get the OWIN Startup class to run in IIS Express after renaming ASP.NET project file
If you don't want to use the OWIN startup, this is what you should add to your web.config file:
Under AppSettings add the following line:
<add key="owin:AutomaticAppStartup" value="false" />
This is how it should look like in your web.config:
<appSettings>
<add key="owin:AutomaticAppStartup" value="false" />
</appSettings>
This could be faced in Visual Studio 2015 as well when you use the Azure AD with a MVC project. Here it create the startup file as Startup.Auth.cs in App_Start folder but it will be missing the
[assembly: OwinStartup(typeof(MyWebApp.Startup))]
So add it and you should be good to go. This goes before the namespace start.