No OWIN authentication manager is associated with the request
Have you ever seen the ASP.NET Web API Error Message, “No OWIN authentication manager is associated with the request”? I get this every time I generate a new ASP.NET Web API project, so I thought I would post this simple solution to keep me and hopefully you from making the same mistake in the future.
The reason you see this error when you try to run your shiny new API is you have removed the scaffolded authentication parts. I am sure I could generate an empty API project and avoid this issue. But I seem to always spend more time getting those projects running that it takes to just scrape out the extras included in the full project. Inevitably I forget a step or two, one being the fix to this exception.
In the scaffolded WebApiConfig.cs file, located in the App_Start folder, you need to remove or comment out the following lines:
You should now be able to run your API, assuming you have carved out the other extraneous references. Maybe I will learn to use the empty API template in the near future. To be honest I am waiting to see where vNext winds up before getting too committed to anything in the ASP.NET stack.