OWIN Startup Class Missing

C#asp.net Mvc-4Visual Studio-2012Owin

C# Problem Overview


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 MVC4.

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.

C# Solutions


Solution 1 - C#

Create One Class With Name Startup this will help you..

public class Startup
{
   public void Configuration(IAppBuilder app)
   {
      app.MapSignalR();
   }
}

Solution 2 - C#

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.

Solution 3 - C#

On Visual Studio 2013 RC2, there is a template for this. Just add it to App_Start folder.

enter image description here

The template produces such a class:

using System;
using System.Threading.Tasks;
using Microsoft.Owin;
using Owin;

[assembly: OwinStartup(typeof(WebApiOsp.App_Start.Startup))]

namespace WebApiOsp.App_Start
{
    public class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            // For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=316888
        }
    }
}

Solution 4 - C#

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>

Solution 5 - C#

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

Solution 6 - C#

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.

Solution 7 - C#

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.

Solution 8 - C#

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:

  1. Added this entry to the top of the AppSettings section of my web.config:

    <add key="owin:AutomaticAppStartup" value="false"/>

  2. 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.

Solution 9 - C#

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>

Solution 10 - C#

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)

Solution 11 - C#

My case? I had startup file, but it is excluded in the project. I just included it and the error left.

Solution 12 - C#

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.

Solution 13 - C#

Are you really trying to add OWIN to your project or is this something unexpected?

  1. In case you want to add OWIN, adding a Startup class is the way to go.

  2. In case you don't need any reference to Owin:

delete Owin.dll from your /bin folder.

Owin.dll is the one trying to identify the Startup class.

Solution 14 - C#

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: https://stackoverflow.com/q/30242581/571237

Solution 15 - C#

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.

Solution 16 - C#

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.

Solution 17 - C#

I kept getting the same error when I started my project using the Browser Link Dashboard in VS2013. But, when I ran my project in debug mode, it would work. I could not figure out why and how to get the Browser Link Dashboard working. I checked the startup file, it was fine, added the appSetting line as described in some of the answers "", but nothing worked.

Apparently, what I was doing wrong was clicking on the WRONG link in the Browser Dashboard. All the Solutions projects links show in the Browser Dashboard, but only the startup projects link works. You need to click on the link of the startup project.

Example: I have 2 projects, both show in the Browser Dashboard, but only the one marked as the start up project will work (shows as bold in the Solution Explorer.) I thought this may help someone do the obvious, it cost me 2 days to stumble on to the obvious.

Solution 18 - C#

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.

Solution 19 - C#

In my case I logged into ftp server. Took backup of current files on ftp server. Delete all files manually from ftp server. Clean solution, redeployed the code. It worked.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionKrunal PatilView Question on Stackoverflow
Solution 1 - C#crackerView Answer on Stackoverflow
Solution 2 - C#Hüseyin YağlıView Answer on Stackoverflow
Solution 3 - C#TimuçinView Answer on Stackoverflow
Solution 4 - C#Yonatan AyalonView Answer on Stackoverflow
Solution 5 - C#Christian PhillipsView Answer on Stackoverflow
Solution 6 - C#SlatersView Answer on Stackoverflow
Solution 7 - C#TCCView Answer on Stackoverflow
Solution 8 - C#Jason MarsellView Answer on Stackoverflow
Solution 9 - C#UnlearndView Answer on Stackoverflow
Solution 10 - C#mcarterView Answer on Stackoverflow
Solution 11 - C#Gellie AnnView Answer on Stackoverflow
Solution 12 - C#DiceyusView Answer on Stackoverflow
Solution 13 - C#carrauaView Answer on Stackoverflow
Solution 14 - C#Sam StorieView Answer on Stackoverflow
Solution 15 - C#Owen PaulingView Answer on Stackoverflow
Solution 16 - C#IanView Answer on Stackoverflow
Solution 17 - C#alikuliView Answer on Stackoverflow
Solution 18 - C#PersyJackView Answer on Stackoverflow
Solution 19 - C#KurkulaView Answer on Stackoverflow