Replace WebActivator PreApplicationStartMethod with OwinStartupAttribute?

3.4k Views Asked by At

I'm using WebActivator.PreApplicationStartMethod in my current project but it seems like the OwinStartupAttribute could do the same job? Is this the proper use of the OwinStartupAttribute?

1

There are 1 best solutions below

2
On BEST ANSWER

PreApplicationStartMethodAttribute allows you to run some code early in the ASP.NET pipeline. ASP.NET requests are handled by the IIS pipeline.

Owin middleware is designed to run in a server-agnostic pipeline.
You could host owin middleware in a non-IIS environment, basically.

If you want to run Owin through the IIS pipeline you have to install and use Owin.Host.SystemWeb:

Install-Package Microsoft.Owin.Host.SystemWeb

and it seems that SystemWeb uses PreApplicationStartMethod to hook into the application startup.

So, I guess, there not much difference at the moment.

I would stick to Owin Startup considering things might change in the future.

I have found a great explanation here and these articles are worth reading.