Hi, I have just created a project using Visual Studio 2015 & selected MVC template, but When I tried to build the project and executed it in the browser, I got the error as below
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.
Here is the Image of the error
How can I resolve this error?What did I miss?
Thanks
1. Check if there is Startup.cs file in the root folder of your project, if not please create startup.cs in the root of propject like below example
public class Startup
{
//For more information on how to configure your application,
//visit http://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
}
public void Configure(IApplicationBuilder app)
{
app.UseMvc();
}
}
2. OR add the key owin:AutomaticAppStartup set to false in your appSettings
<appSettings>
<addkey="owin:AutomaticAppStartup" value=“false“ />
</appSettings>
One of the above solutions should solve your issue
If you got this error, while removing OWIN from your project, you can do this
For those who want OWIN and getting this error
using Microsoft.Owin;
using Owin;
[assembly: OwinStartupAttribute(typeof(ProjectNameSpace.Startup))]
namespace ProjectNameSpace
{
public partial class Startup
{
public void Configuration(IAppBuilder app)
{
ConfigureAuth(app);
}
}
}?
<appSettings>
<addkey="owin:AutomaticAppStartup" value=“false“ />
</appSettings>?
That's it.
Subscribe to our weekly Newsletter & Keep getting latest article/questions in your inbox weekly