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
?
Asked
Active
Viewed 3,356 times
5

marcus
- 9,616
- 9
- 58
- 108
1 Answers
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.

LeftyX
- 35,328
- 21
- 132
- 193
-
In my application WebActivator.PreApplicationStartMethod runs before Application_Start() but OwinStarup runs after Application_Start() so it does not seem to replace WebActivator? – marcus Jul 27 '14 at 11:38
-
@Marcus: You're right. Owin startup should, in fact, replace Application_Start. – LeftyX Jul 28 '14 at 18:20