Friday 17 June 2016

Owin Startup Not Executed

I've been bashing my head over this problem today. My Owin Startup class wasn't being executed. I'd followed the usual instructions of ensuring the "Microsoft.Owin.Host.SystemWeb" package was installed. I had the correct attribute on the assembly ([assembly: OwinStartup(typeof(StartupDemo.TestStartup))]), clearing the ASP.NET cache, etc etc.

Eventually I found that if you have set a friendly name for your startup class (in the instance where you may have multiple Startup.cs files) - then you need to also make sure you add the friendly name to your appSettings in the web.config too!

<add key="owin:appStartup" value="StartupDemo.ProductionStartup"/>

Doh!