[c#] OWIN Startup Class Missing
In our project, we didn't need the OWIN functionality, so we removed all the owin references from the initial ASP.NET MVC template project. The problem occured after removing the OWIN startup class.
The problem was the extra owin dll's in my bin folder. When I deleted them, the problem was resolved. You should delete them by deleting the bin folder. Clean Solution does not delete these dlls.
Somehow, IIS still executes the OWIN dll's when they are in the bin folder.
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 Nuget still getting the same issue. I'm using
Visual Studio 2012 and
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. To disable OWIN startup discovery, add the appSetting owin:AutomaticAppStartup with a value of "false" in your web.config. To specify the OWIN startup Assembly, Class, or Method, add the appSetting owin:AppStartup with the fully qualified startup class or configuration method name in your web.config.
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.
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>
I ran into this problem after experimenting with SignalR and then removing it from the project. To resolve I had to delete the contents of the bin folder for the site on the remote server and then publish again.
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
So add it and you should be good to go. This goes before the namespace start.
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
AppSettingssection 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.
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.