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
I had this problem, understand this isn't what was wrong in the OP's case, but in my case I did have a Startup class, it just wasn't finding it by default.
My problem was the I had spaces in my Assembly Name, and hence the default namespace was different from assembly name, hence the namespace for the startup class was different than the assembly name.
As the error suggests, by convention it looks for [Assembly Name].Startup for the class... so be sure the namespace for your Startup class is the same as the Assembly name. Fixed the problem for me.
It is also possible to get this exception (even when you have a correctly configured startup class) if running through IIS Express and your virtual directory is not configured correctly.
When I encountered this issue, the resolution was simply to press the 'Create Virtual Directory' button in the 'Web' tab of project properties (Using Visual Studio 2013)
I tried most of the recommended fixes here, and still couldn't avoid the error message. I finally performed a combination of a few recommended solutions:
Added this entry to the top of the AppSettings
section of my web.config:
<add key="owin:AutomaticAppStartup" value="false"/>
Expanded the References node of my project and deleted everything that contained the string OWIN
. (I felt safe doing so since my organization is not (and won't be) an active OWIN provider in the future)
I then clicked Run
and my homepage loaded right up.
I had this problem when I got the latest on TFS while other projects were open in multiple instances of VS. I already have all the fixes above. Reopening VS fixed the problem.
First you have to create your startup file and after you must specify the locale of this file in web.config, inside appSettings tag with this line:
<add key="owin:AppStartup" value="[NameSpace].Startup"/>
It solved my problem.
In my case, I had renamed the project and changed it's folder structure. I found that updating the RootNameSpace and AssemblyName in the .csproj file where the error was being thrown resolved the error. If you have modified paths of your project I'd recommend checking this as well.
<RootNamespace>Company.Product.WebAPI</RootNamespace>
<AssemblyName>Company.Product.WebAPI</AssemblyName>