No assembly found containing an OwinStartupAttribute Error
Solution 1:
Add this code in web.config
under the <configuration>
tag as shown in image below. Your error should then be gone.
<configuration>
<appSettings>
<add key="owin:AutomaticAppStartup" value="false" />
</appSettings>
...
</configuration>
Solution 2:
I wanted to get rid of OWIN in the project:
- Delete OWIN references and Nuget packages from project
- Clean & Rebuild project
- Run app
Then I got OWIN error. These steps didn't work, because OWIN.dll was still in bin/ directory.
FIX:
- Delete bin/ directory manually
- Rebuild project
Solution 3:
For those who do want owin to start, <add key="owin:AutomaticAppStartup" value="false" />
won't work, but the following worked for me.
if you have a partial class "Startup" in your Startup.Auth file, create another partial Startup class in the root of your project.
define an assembly owinstartup attribute pointing to that class
create a "Configuration" method
rebuild your application
You could also create the "Configuration" method, and add the assembly attribute to the Startup.Auth, but doing it this way allows you to keep your Startup class separated by leveraging C# class definition splitting. Read more here: https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/partial-classes-and-methods
This is what my Startup.cs file looked like:
using Microsoft.Owin;
using Owin;
[assembly: OwinStartupAttribute(typeof(ProjectNameSpace.Startup))]
namespace ProjectNameSpace
{
public partial class Startup
{
public void Configuration(IAppBuilder app)
{
ConfigureAuth(app);
}
}
}
Solution 4:
I was missing the attribute:
[assembly: OwinStartupAttribute(typeof(projectname.Startup))]
Which specifies the startup class. More details: https://docs.microsoft.com/en-us/aspnet/aspnet/overview/owin-and-katana/owin-startup-class-detection
Solution 5:
Check if you have the Startup class created in your project. This is an example:
using Microsoft.Owin;
using Owin;
[assembly: OwinStartupAttribute(typeof({project_name}.Startup))]
namespace AuctionPortal
{
public partial class Startup
{
public void Configuration(IAppBuilder app)
{
ConfigureAuth(app);
}
}
}