I'm required to write some custom middleware to work with EPiServer CMS. I'd like to remove Application_Start() and run everything from StartUp.Configuration()
This seems possible with a baseline MVC 4 application since you can register routes and do all of the necessary start up tasks by calling methods within Configuration().
However, EPiServer's methods for registering routes and etc are protected (and I don't know all of the necessary ones).
I anticipate the following benefits by running the app with Startup instead of Global.asax
1) If I can control when initialization modules are ran, then I can use service location in my custom middleware
2) I decrease complexity by not having two application starting points for the same app
These are both important to me. I would prefer to not use Application_Start() unless I absolutely have to.
My research has revealed one potential method of doing this by using EPiServer.ServiceAPi - but the core purpose of ServiceApi would not be used within my app. It seems wasteful to bring it in purely for OWIN compatibility. Also it has an OAuth provider dependency which I do not wish to fill at this time as my app does not require it.
Has anyone done this successfully? Can anyone offer guidance?
I appreciate your time and I'm happy to provide clarification on my question where necessary.
Sometimes I'm using InitializationModules to register those things.
Hi,Current version of EpiServer is already running with OWIN and comes with an implementation of AspNet Identity . If you download the VS extension you create the standard Alloy (MVC) site and see how it has a Startup class instead of Global.asax.