I have been working on fixing problems with a C# ASP.NET application using the OWIN framework I inherited, not knowing a lot about what I am doing. The application consists of 4 interdependent projects, each building a DLL via msbuild. I have yet to understand how IIS knows how to run this application. As far as I can tell, there is nothing in the web.config to indicate it. Now, the primary DLL, which makes calls into the other three has source file called Startup.cs. It includes this directive:
[assembly: OwinStartup(typeof(MyProject.Web.Startup))]
Even though the source is all compiled into the DLL, this Startup.cs file is distributed. In addition, the csc compiler is distributed with the deployables.
So, I'm left guessing maybe:
- IIS compiles this Startup.cs file when an HTTP request is received the first time because it finds it laying around or
- IIS looks at the DLLs it finds in the root directory and notices one has the OwinStartup assembly and invokes the Startup class and the Configuration method in this class.
Either is magic, it seems, with no specific references in web.config. How does IIS know what to do?