title: Routing HTTP Error 404.0 0x80070002
body: <p>I have created routing rules in my ASP.NET application and on my Dev machine at IIS7 everything works fine. When I deploy solution to prod server which has also IIS7 I get error 404 (page not found) while accessing URL. Maybe someone could point where is the problem?</p>
  
  <p>Actual error</p>
  
  <blockquote>
    <p>HTTP Error 404.0 - Not Found The
    resource you are looking for has been
    removed, had its name changed, or is
    temporarily unavailable. Detailed
    Error InformationModule IIS Web Core 
    Notification MapRequestHandler 
    Handler StaticFile  Error Code
    0x80070002  Requested URL
    <a href="http://xxx.xxx.xxx.xxx:80/pdf-button" rel="noreferrer">http://xxx.xxx.xxx.xxx:80/pdf-button</a> 
    Physical Path
    C:\www\pathtoproject\pdf-button  Logon
    Method Anonymous  Logon User Anonymous</p>
  </blockquote>
  
  <p>My Actual Code</p>
  
  <pre><code>     &lt;add key="RoutePages" value="all,-forum/"/&gt;
  
               UrlRewrite.Init(ConfigurationManager.AppSettings["RoutePages"]);
  
  
      public static class UrlRewrite
      {
              public static void Init(string routePages)
              {
  
                  _routePages = routePages.ToLower().Split(new[] { ',' });
                  RegisterRoute(RouteTable.Routes);
  
  
  
  
              }
  
              static void RegisterRoute(RouteCollection routes)
              {
  
                  routes.Ignore("{resource}.axd/{*pathInfo}");
                  routes.Ignore("favicon.ico");
                  foreach (string routePages in _routePages)
                  {
                      if (routePages == "all")
                          routes.MapPageRoute(routePages, "{filename}", "~/{filename}.aspx");
                      else
                          if (routePages.StartsWith("-"))
                              routes.Ignore(routePages.Replace("-", ""));
                          else
                          {
                              var routePagesNoExt = routePages.Replace(".aspx", "");
                              routes.MapPageRoute(routePagesNoExt, routePagesNoExt, string.Format("~/{0}.aspx", routePagesNoExt));
                          }
                  }
  
              }
  }
  </code></pre>