Replace WebActivator PreApplicationStartMethod with OwinStartupAttribute?
Asked Answered
C

1

5

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?

Callboard answered 24/6, 2014 at 7:19 Comment(0)
L
7

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.

Lilithe answered 24/6, 2014 at 13:35 Comment(2)
In my application WebActivator.PreApplicationStartMethod runs before Application_Start() but OwinStarup runs after Application_Start() so it does not seem to replace WebActivator?Callboard
@Marcus: You're right. Owin startup should, in fact, replace Application_Start.Lilithe

© 2022 - 2024 — McMap. All rights reserved.