title: Instantiation of ASP.NET Core application in production
body: <p>ASP.NET Core starts executing from <code>Main</code> method which lies in <code>Program class</code> inside <code>Program.cs</code> file. That builds a web hosting environment and tell that web host to start running. Then, there is <code>startup.cs</code> file. </p>
  
  <p>When developing a .NET Core web application, I have to build it locally (by Ctrl-F5 for example). When doing that, <code>Main</code> method is running. Every next time I want to open my web application, given IIS Express has already been launched, I am just writing e.g. <a href="http://localhost:65040" rel="nofollow noreferrer">http://localhost:65040</a>. By doing that, <code>Main</code> method <strong>is not running</strong> again, but everything works fine (routing etc..). So, <strong><em>I have the following question</em></strong>:</p>
  
  <p>How .NET Core knows what to do upon the reception of the above Http request (<a href="http://localhost:65040" rel="nofollow noreferrer">http://localhost:65040</a>)? For example, how does it implement routing since </p>
  
  <pre><code>app.UseMvc(routes =&gt;
  {
      app.UseMvcWithDefaultRoute();
  })
  </code></pre>
  
  <p>in <code>Startup.cs</code> is not running again? <code>There is no need for that because IIS has already been informed?</code></p>
  
  <p>And if the above thought is correct what exactly is happening in <code>deployment</code>? Then our Http requests never trigger <code>program.cs</code> and <code>startup.cs</code>. <strong>So, in which way the remote web server is being informed about stuff how to implement routing etc?</strong></p>