2

I know Owin middlewares configured assemblying a pipeline for every request just like classic asp.net pipeline. However, how to have certain middlewares run only once the application starts just like Application_Start?

Owin middlewares are supposed to replace the asp.net pipeline. So if Global.asax is removed, using Owin middlewares can process requests in the same way. But I don't see how Owin define which middlewares run only when application starts such as singletons, global static variables etc..

Thanks

Xiaowei.Jia
  • 415
  • 1
  • 4
  • 13
  • possible duplicate of [Do I need a Global.asax.cs file at all if I'm using an OWIN Startup.cs class and move all configuration there?](http://stackoverflow.com/questions/20168978/do-i-need-a-global-asax-cs-file-at-all-if-im-using-an-owin-startup-cs-class-and) – Panagiotis Kanavos Aug 12 '15 at 07:29
  • Don't think it is the same. My question is about having certain Owin middlewares run once at application start and the rest run for every request. – Xiaowei.Jia Aug 12 '15 at 07:59
  • Why not? The configuration phase occurs only during application start. If you want something to run only once, you can do it there. – Panagiotis Kanavos Aug 12 '15 at 08:58
  • Ah, now I understand. The Configuration runs only once at application starts. but the chain of middlewares run for every request. Am I right? – Xiaowei.Jia Aug 12 '15 at 09:38

0 Answers0