title: ASP.NET Web API2 - suddenly won't display page
body: <p>All of a sudden my app won't display a page and I now get "You do not have permission to view this directory or page." <a href="https://stackoverflow.com/questions/12495346/asp-net-4-5-mvc-4-not-working-on-windows-server-2008-iis-7">I looked at this</a> but the suggestions there didn't help.</p>
  
  <p>for my code:</p>
  
  <pre><code>[ServiceContract]
  [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
  [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
  // NOTE: If this class is renamed, remember to update the global.asax.cs file
  public class Service
  {
      [WebGet(UriTemplate = "")]
      public string GetTest()
      {
          return "Windward update REST service running.";
      }
  }
  </code></pre>
  
  <p>When I request an aspx page, it works.</p>
  
  <p>Global.asx.cs:</p>
  
  <pre><code>public class Global : HttpApplication
  {
      private static readonly ILog log = LogManager.GetLogger(typeof(Global));
  
      void Application_Start(object sender, EventArgs e)
      {
          RegisterRoutes();
  
          log4net.Config.XmlConfigurator.Configure();
          log.Info(string.Format("Update REST server started, running under user {0}", WindowsIdentity.GetCurrent().Name));
      }
  
      private void RegisterRoutes()
      {
          // The class providing the REST service
          RouteTable.Routes.Add(new ServiceRoute("Service", new WebServiceHostFactory(), typeof(Service)));
      }
  </code></pre>
  
  <p>web.config (relevant parts):</p>
  
  <pre><code>  &lt;system.web&gt;
      &lt;compilation debug="true" targetFramework="4.5"/&gt;
      &lt;pages controlRenderingCompatibilityVersion="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;!-- 
              Configure the WCF REST service base address via the global.asax.cs file and the default endpoint 
              via the attributes on the &lt;standardEndpoint&gt; element below
          --&gt;
          &lt;standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true"/&gt;
        &lt;/webHttpEndpoint&gt;
      &lt;/standardEndpoints&gt;
    &lt;/system.serviceModel&gt;
  </code></pre>
  
  <p>Nothing substantive has changed. So why do the requests no longer call the service?</p>
  
  <p>thanks - dave</p>