title: ASP.NET Routing in rest service not working in IIS
body: <p>I created a simple rest service with routing enabled. The routing is properly working when i run it locally i.e using asp.net development server. But when I deploy the application in IIS (IIS 7.5) then it and try to access the method in the service i get the error <strong>HTTP 404.0 Not found</strong>. Here is my code : </p>
  
  <pre><code>[ServiceContract]
  [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
  [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
  public class HelloWorldService
  {
  
      [WebGet(UriTemplate = "Date")]
      public DateTime Date()
      {
          return System.DateTime.Now;
      }
  
  }
  </code></pre>
  
  <p>Global.asax:</p>
  
  <pre><code>    protected void Application_Start(object sender, EventArgs e)
      {
          RegisterRoutes();
      }
      private void RegisterRoutes()
      {           
          RouteTable.Routes.Add(new ServiceRoute("ServiceData", new WebServiceHostFactory(), typeof(HelloWorldService)));
      }
  </code></pre>
  
  <p>Web.config:</p>
  
  <pre><code>&lt;configuration&gt;
  &lt;system.web&gt;
      &lt;compilation debug="true" targetFramework="4.0" /&gt;
  &lt;/system.web&gt;
  
  &lt;system.webServer&gt;
      &lt;modules runAllManagedModulesForAllRequests="true"&gt;
          &lt;add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /&gt;
      &lt;/modules&gt;
  &lt;/system.webServer&gt;
  
  &lt;system.serviceModel&gt;
      &lt;serviceHostingEnvironment aspNetCompatibilityEnabled="true"/&gt;
      &lt;standardEndpoints&gt;
          &lt;webHttpEndpoint&gt;
              &lt;standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true"/&gt;
          &lt;/webHttpEndpoint&gt;
      &lt;/standardEndpoints&gt;
  &lt;/system.serviceModel&gt;
  
  &lt;/configuration&gt;
  </code></pre>
  
  <p>I also Enabled HTTP Redirection Feature under</p>
  
  <p><strong>Windows Features -> Internet Information Services -> Word Wide Web services -> Common HTTP Features</strong></p>
  
  <p>I also tried Adding handlers like </p>
  
  <pre><code>&lt;handlers&gt;
    &lt;add name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd" type="System.Web.HttpForbiddenHandler, System.Web, 
         Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/&gt;
  &lt;/handlers&gt;
  </code></pre>
  
  <p>Also i have tried all the other solutions that were suggested on the web but nothing works. Thanks in advance for any help.</p>