After trying to enable owin & AspNet Identity to my Web Api project (in VS 2013 + .Net 4.5.1) I get the following error in each valid or unvalid(request to none exist co
My case, it failed since this settings in web.config. Hope this helps someone to avoid it.
<appSettings>
<add key="owin:AutomaticAppStartup" value="false" />
</appSettings>
I originally created the project with authentication, but then decided to disable it. I had to remove this in the WebApiConfig.cs
file. Make sure you have this if you intend to enable authentication.
// Web API configuration and services
// Configure Web API to use only bearer token authentication.
config.SuppressDefaultHostAuthentication();
config.Filters.Add(new HostAuthenticationFilter(OAuthDefaults.AuthenticationType));
if you don't actually need OWIN you can simply uninstall it.
one way to do it is in Nuget Manager uninstall every OWIN library, the order will be dictated by their dependencies.
after this is done you don't need any OWIN related code or config. this worked out best for me since I am using windows auth.
For .Net framework adding the runAllManagedModulesForAllRequests attribute to the modules in web.config . This way I kept the authentication exist.
<modules runAllManagedModulesForAllRequests="true">
Changing the owin:AutomaticAppStartup
key to true
in Web.config fixed this for me, i.e. change it from:
<appSettings>
<add key="owin:AutomaticAppStartup" value="false" />
</appSettings>
to this:
<appSettings>
<add key="owin:AutomaticAppStartup" value="true" />
</appSettings>
I had the same problem. The package was not appearing in the NuGet Package manager. I added reference in packages.config:
<package id="Microsoft.Owin.Host.SystemWeb" version="2.1.0" targetFramework="net45" />
And reference in the project file (xxx.csproj):
<Reference Include="Microsoft.Owin.Host.SystemWeb">
<HintPath>..\packages\Microsoft.Owin.Host.SystemWeb.2.1.0\lib\net45\Microsoft.Owin.Host.SystemWeb.dll</HintPath>
</Reference>