title: ASP.NET MVC Routing, TransferRequestHandler dont work in ClassicMode with IIS
body: <p>I have a web site in my local IIS.
  The Application Pool for this site it is in Clasic Mode.</p>
  
  <p>I am mapping a path of a file to a route on MVC.</p>
  
  <p>I have the route register like this</p>
  
  <pre><code>public static void RegisterRoutes(RouteCollection routes)
  {
      routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
  
      //routes.RouteExistingFiles = true;
      routes.MapRoute(
          name: "XMLPath",
          url: "sitemapindex.xml",
          defaults: new { controller = "Home", action = "Html", page = UrlParameter.Optional }
      );
  
      routes.MapRoute(
          name: "Default",
          url: "{controller}/{action}/{id}",
          defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
      );
  }
  </code></pre>
  
  <p>In my controller I have this method</p>
  
  <pre><code>public FileResult Html()
  {
      var stringBuilder = new StringBuilder();
      stringBuilder.AppendLine("&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;");
      stringBuilder.AppendLine("&lt;sitemapindex xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"&gt;");
      stringBuilder.AppendLine("&lt;sitemap&gt;");
      stringBuilder.AppendLine("&lt;loc&gt;http://[site]/sitemaps/sitemap_01.xml&lt;/loc&gt;");
      stringBuilder.AppendLine("&lt;lastmod&gt;" + DateTime.Now.ToString("MMMM-dd-yyyy HH:mm:ss tt") + "&lt;/lastmod&gt;");
      stringBuilder.AppendLine("&lt;/sitemap&gt;");
      stringBuilder.AppendLine("&lt;sitemap&gt;");
      stringBuilder.AppendLine("&lt;loc&gt;http://[site]/sitemaps/sitemap_02.xml&lt;/loc&gt;");
      stringBuilder.AppendLine("&lt;lastmod&gt;" + DateTime.Now.ToString("MMMM-dd-yyyy HH:mm:ss tt") + "&lt;/lastmod&gt;");
      stringBuilder.AppendLine("&lt;/sitemap&gt;");
      stringBuilder.AppendLine("&lt;/sitemapindex&gt;");
  
      var ms = new MemoryStream(Encoding.ASCII.GetBytes(stringBuilder.ToString()));
  
      Response.AppendHeader("Content-Disposition", "inline;filename=sitemapindex.xml");
  
      return new FileStreamResult(ms, "text/xml");
  }
  </code></pre>
  
  <p>And in my web.cong I add this</p>
  
  <pre><code>&lt;handlers&gt;
      &lt;add name="HtmlFileHandler" path="*.xml" verb="GET" type="System.Web.Handlers.TransferRequestHandler" preCondition="classicMode,runtimeVersionv4.0" /&gt;
      &lt;/handlers&gt;&lt;/system.webServer&gt;
  &lt;runtime&gt;
  </code></pre>
  
  <p>All this is similar to 
  <a href="http://weblogs.asp.net/jongalloway/asp-net-mvc-routing-intercepting-file-requests-like-index-html-and-what-it-teaches-about-how-routing-works" rel="nofollow">http://weblogs.asp.net/jongalloway/asp-net-mvc-routing-intercepting-file-requests-like-index-html-and-what-it-teaches-about-how-routing-works</a></p>
  
  <p>The only differences is that using preCondition="classicMode,runtimeVersionv4.0"  not preCondition="integratedMode,runtimeVersionv4.0".</p>
  
  <p>If I run the project in Visual Studio 2013 work perfect, but when I run it in the IIS doesn't works. If I change the AppPool of my IIS to integrate mode works.
  But I need to have the AppPool in Classic Mode.</p>
  
  <p>When I run the Route (url) [site]/sitemapindex.xml in classic mode I get this error:</p>
  
  <p>HTTP Error 500.21 - Internal Server Error
  Handler "HtmlFileHandler" has a bad module "ManagedPipelineHandler" in its module list</p>
  
  <p>This a <a href="https://www.dropbox.com/s/w6qsowt919ivex1/XmlTest.rar?dl=0" rel="nofollow">Example Project</a> that I am using.
  How I can used System.Web.Handlers.TransferRequestHandler in classicMode in a IIS Site?</p>