1
votes

ASP MVC 3 in IIS 7 and HTTP Error 403.14 - Forbidden

I have been working in ASP.NET MVC 3 nowadays, but something ocurred silently and I can't realized what is it wrong. The project suddenly stop working with IIS, on debug mode VS 2012 doesn't open the browser window (Google Chrome v.25 beta, Mozilla Firefox 19.0) anymore. I have visited several links that refers to, but the solution doesn't embraces. When I push the button for Create Virtual Directory on IIS Local Web Server it responds OK, but the site is never created in the Pool. Any help is appreciated.

  • OS Architecture is Windows x64
  • VS 2012 Ultimate
  • IIS v7

I have already tried these advices without success:

4
If the site isn't being created by Visual Studio, why don't you just create it manually in IIS? By the way, you might want to reword your question slightly. If you think help is overrated, you probably won't get any. Don't you mean appreciated?levelnis

4 Answers

3
votes

Solution found. I hope this contribute to others stacked. All of previous articles were useful, helping me understand better IIS engineering.

If the site doesn't have correct Routes it will show an undesirable page code 403.14. Pages can't be shown from directories that don't accomplish necessary permissions. When routes are incorrect it redirects by default to server protected directories.

This article that I listed before is the most complete. I had this errors when I deployed the first project after VS 2010/2012 installation process. So, don't be worried, it happens.

  • ASP.NET MVC on IIS 7.5
  • ASP.NET MVC 3: A default document is not configured

     <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules runAllManagedModulesForAllRequests="true"></modules> <!--THIS ONE -->
    <!--<modules>
      <remove name="UrlRoutingModule-4.0" />
      <add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="" />
      --><!-- any other modules you want to run in MVC e.g. FormsAuthentication, Roles etc. --><!--
    </modules>-->
    

Ocurrs when Routing is wrong and this part is enabled in *Web.config **<system.WebServer>*** section

<system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
  <!--  <modules runAllManagedModulesForAllRequests="true"></modules> -->

<modules> <!--THIS ONE -->
      <remove name="UrlRoutingModule-4.0" />
      <add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="" />
      <!-- any other modules you want to run in MVC e.g. FormsAuthentication, Roles etc. -->
    </modules>
  </system.webServer>

Ocurrs when Routing is wrong and this part is enabled in *Web.config **<system.WebServer>*** section

My contribution: If anyone is an acolyte of the ReSharper Refactoring feature or any other refactoring tool, beware of using it indiscriminately, because it would change things unexpectedly. Don't misinterpret my words, it is a fascinating VS addon and I use it in everyday work. But in my case, it modified the routing parameters within RegisterRoutes (...) of the Global.asax.cs file, and of course site couldn't load appropriately (not even the Home Page).

Here is what happened {id}:

public static void RegisterRoutes(RouteCollection routes)
    {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

        routes.MapRoute(
            "Default", // Route name
            "{controller}/{action}/{id}", // URL ORIGINAL VALUES
            new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
        );

    }

By this hell {referenceId}:

public static void RegisterRoutes(RouteCollection routes)
    {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

        routes.MapRoute(
            "Default", // Route name
            "{controller}/{action}/{referenceId}", // URL MODIFIED VALUES
            new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
        );

    }
1
votes

Been banging my head with this error until i realised that i had marked the member as static on the Appplication_OnStart.

This happened mistakenly to a Code Analysis warning that i did not suppress, so headless as i was i followed the best practice on the CA1822 Warning.

 protected static void Application_Start()
    {
        AreaRegistration.RegisterAllAreas();
        WebApiConfig.Register(GlobalConfiguration.Configuration);
        FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
        RouteConfig.RegisterRoutes(RouteTable.Routes);
    }
0
votes

Another way for this error : If you put that in your global.asax :

     protected void Application_OnStart()
    {

    }

You'll get the 403.1 error.

0
votes

If anyone is still looking at any 403 errors with MVC and Web deploy and none of the previous answers helped (as with me), there's one more thing I found to look at.

dlls

Explanation: Though many forums I found that one possible cause to the 403 was dll related. And I eventually checked that area, and notices that I was missing a lot of dlls. I copied over all of the dlls and the site began to work properly. I believe that the dlls were missing because they were not set to copy local so they were not published with the site (though I haven't confirmed this)(nor narrowed down 'which' missing dlls were the issue), but figured it could be helpful to post.