title: Handler "ExtensionlessUrlHandler-Integrated-4.0" has a bad module "ManagedPipelineHandler" in its module list
body: <p>To be honest, I've tried to turn a dirty trick on IIS and just when I thought that I was going to get away with it, I realized my workaround doesn't work. Here's what I've tried to do:</p>
  
  <p>1) I have ASP.NET application which has <strong>Preloader</strong> class that inherits <strong>IProcessHostPreloadClient</strong> and does all the heavy initialization in <em>Preload</em> method implementation (application is complex and it's a part of an enormous system, so it requires approximately 2 minutes to establish connections to all necessary services and pre-instantiate some Unity registrations).</p>
  
  <p>2) I have a lot of work that needs to be done on application shutdown (unsubscribing, disconnecting, disposing,...), and I guess the best place to do it is in *Application_End* method located in <strong>Global.asax</strong>.</p>
  
  <p>3) Everything works just fine when I have user activity (first request after the Application Pool that contains aforementioned web application is started will cause *Application_Start* to be called and afterwards *Application_End* is called on Application Pool stop or recycle), but problems occur when there is no user activity and application tries to restart itself after being active for 48 hours (configured requirement). Since there was no requests, application officially didn't get started. Ergo, it can't be gracefully stopped since *Application_End* won't be called.</p>
  
  <p>4) Now comes the messy part... I've tried to make a GET request from code at the end of the <em>Preload</em> method, and it worked. But this solution seemed bad to me, even though it worked. So, I've tried a lot of things, and the last thing I tried was this:</p>
  
  <pre><code>SimpleWorkerRequest swr = new SimpleWorkerRequest(string.Empty, string.Empty, tw);
  HttpRuntime.ProcessRequest(swr);
  </code></pre>
  
  <p>... and that has done it's purpose. *Application_Start* was called, (I've checked response, it was containing login page that was supposed to be displayed in initial request) and on Application Pool shutdown application ended gracefully by doing necessary work in *Application_End*.</p>
  
  <p><strong>BUT</strong></p>
  
  <p>After the application was started (preloaded and initiated) in this manner, this is what happened when I wanted to reach application via Web browser:</p>
  
  <blockquote>
    <p>HTTP Error 500.21 - Internal Server Error
    Handler "ExtensionlessUrlHandler-Integrated-4.0" has a bad module "ManagedPipelineHandler" in its module list</p>
  </blockquote>
  
  <p>I am unable to figure this out. Can anybody tell me why this happens and how to fix it?</p>
  
  <p>If I don't figure this out, I will go back to first solution (sending GET request from code) but this problem will bug me since I don't even have an idea what's wrong.</p>