Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does OWIN invoke MVC yet (ASP.NET MVC)?

Looking at a standard new MVC 5 project in Visual Studio 2013 you can see that it now includes OWIN.

There's a new OWIN Startup class that configures auth however I can't see how/where MVC5 is registered with OWIN. Where does this happen?

I'm assuming here that all requests pass through OWIN before entering the MVC pipeline. Why else would they include OWIN?

  • Please note: I'm not asking how OWIN is setup, that's easily explained in the docs. I'm interested in how MVC5 uses OWIN.
like image 492
Daniel Little Avatar asked Oct 25 '13 08:10

Daniel Little


1 Answers

Update: I figured out why MVC5 uses OWIN even though requests are handled by the IIS pipeline instead of OWIN.

MVC5 does not pass through OWIN, however it looks like this could change in the future. Instead MVC currently still needs to pass through the IIS Integrated Pipeline. The reason that OWIN is included in the default MVC project is so that MVC5 can use the Owin middleware components.

From the OWIN middleware in the iis integrated pipeline:

In order for an OMC to participate in this same, event-based execution ordering, the Katana runtime code scans through the startup configuration and subscribes each of the middleware components to an integrated pipeline event.

This does change in ASP.NET vNext as Web.Api and MVC have been combined and abandon System.Web in favour of OWIN and project Helios.

like image 79
Daniel Little Avatar answered Sep 18 '22 21:09

Daniel Little