MVC4 HTTP Error 403.14 - Forbidden

106,249

Solution 1

Try

<system.webServer>
   <modules runAllManagedModulesForAllRequests="true"/> 
 </system.webServer>

Via

https://serverfault.com/questions/405395/unable-to-get-anything-except-403-from-a-net-4-5-website

Solution 2

Error 403.14 is the HTTP error code for not being allowed to list the contents of a directory. Please be sure that

  1. You have setup the website as an application in IIS
  2. You have .NET 4.5 installed on the server
  3. You have set the application pool to run the proper version of the .NET framework (ie. it is not set to .NET 2.0
  4. You are using the integrated pipeline on your application pool
  5. .NET 4.5 is actually registered in IIS. Please see this post for a similar issue/resolution

Usually, a and d are the biggest issues surrounding MVC deployments to IIS

Solution 3

Perhaps... If you happen to use the Publish Wizard (like I did) and select the "Precompile during publishing" checkbox (like I did) and see the same symptoms...

Yeah, I beat myself over the head, but after unchecking this box, a seemingly unrelated setting, all the symptoms described go away after redeploying.

Hopefully this fixes some folks.

Solution 4

Windows-> Start -> Turn widows features on and off

Make sure you check required options in

enter image description here

Solution 5

Before applying

runAllManagedModulesForAllRequests="true"/>

consider the link below that suggests a less drastic alternative. In the post the author offers the following alteration to the local web.config:

  <system.webServer>
    <modules>
    <remove name="UrlRoutingModule-4.0" />
    <add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="" />
    </modules>

http://www.britishdeveloper.co.uk/2010/06/dont-use-modules-runallmanagedmodulesfo.html

Share:
106,249
mithun_daa
Author by

mithun_daa

.Net dev for over 5 yrs dabbling with Rails/jQuery/Ubuntu

Updated on August 27, 2021

Comments

  • mithun_daa
    mithun_daa over 2 years

    I have build a .net4.5 ASP.NET MVC4 web app which works fine locally (IIS Express & dev server) but once i deploy it to my web server it throws the 403 error. I have installed .Net 4.5RC on the server and even tried the aspnet_regiis -i bit that everyone recommended for their issues with previous versions of MVC/.Net but it did not help.

    Any ideas?

    EDIT: More info about the situation. The server is 32bit and I have 4 other MVC3 applications that work fine. It is just my MVC4 app that is not working.

  • mithun_daa
    mithun_daa almost 12 years
    I am sorry but i did not follow what you meant. This is a 32bit server. I have updated my post to add more info.
  • mithun_daa
    mithun_daa almost 12 years
    1. I have not setup the website as an application. 2. I have .net 4.5 installed, 3.had my app pool targeting the correct framework. 4. My pool was set to use classic, changed it to Integrated but didn't help. 5. I am pretty sure 4.5 is registered.
  • Tommy
    Tommy almost 12 years
    @mithun_daa - If you have not setup your website as an application, its pretty easy -> right click the virtual directory/website and Convert To Application (or add Application, terminology escapes me at the moment)
  • mithun_daa
    mithun_daa almost 12 years
    Is this a MVC4 specific thing? Cause I have never set up my MVC3 projects as Applications and they work just fine.
  • MarkKGreenway
    MarkKGreenway almost 12 years
    Ahhh ... Are they in separate app_pools?
  • mithun_daa
    mithun_daa almost 12 years
    Yes, infact each of my sites have their own app pools.
  • Tommy
    Tommy almost 12 years
    Could be how you are deploying then -> but any .NET web application must be set as an application in IIS. However, if you are just putting these under the default website, then it is running under the default website application. Make sure that the application pool of the default website is configured correctly (.NET 4/integrated). When you create a virtual directory/virtual website in IIS, you have the option of setting it to its own application as well.
  • mithun_daa
    mithun_daa almost 12 years
    I probably confused you but none of the sites are under the Default Web site. I right click "Sites" in IIS7 and choose "Add Web Site". That is how i have been doing.
  • Maxim V. Pavlov
    Maxim V. Pavlov over 11 years
    Had that in place, did everything, and still only MVC 4 sites work. There has to be some other trick that needs to be in place for this to work.
  • Julia Hayward
    Julia Hayward over 11 years
    This. Tried all the other stock solutions with no joy but this was the one that sorted the problem.
  • A.Dara
    A.Dara about 10 years
    Dear friend, I do it, but it doesn't work. Really, I was working with MVC 4 and VisualStudio 2012, my project works well until yesterday, but after some usual changes in my codes, this error rise in default page (home/index). can any body help me please?..
  • Ahmad Ibrahim
    Ahmad Ibrahim about 10 years
    This fix is Not appropriate for this problem (see the link in Jason Koopmans answer). much better is downloading the related hotfix here microsoft.com/en-us/download/…
  • MarkKGreenway
    MarkKGreenway about 10 years
    @AhmadIbrahim it is in fact a solution to the problem. The fix is for 64bit only, the question clearly states 32bit. There are certain configurations for which RAMMFAR is the most reliable working solution, and adds minimal server load if CDN's are appropriately used.
  • devnull
    devnull about 10 years
    Why post the same answer at multiple places?
  • Mastro
    Mastro about 10 years
    Because I was trying to track down the solution, and it pertains to both. Save someone from hunting it around.
  • devnull
    devnull about 10 years
    You shouldn't be posting duplicate answers. That's all I can say.
  • Ahmad Ibrahim
    Ahmad Ibrahim about 10 years
    @MarkKGreenway I think there's a 32-bit version of the fix here microsoft.com/en-us/download/details.aspx?id=11342
  • Ahmad Ibrahim
    Ahmad Ibrahim about 10 years
    @MarkKGreenway you think that this case is one of the certain configurations for which RAMMFAR is the most reliable working solution ?
  • tristankoffee
    tristankoffee about 9 years
    For me, I discovered long ago that I can enter null for the name parameter to avoid making up a name for every route. It turns out that this also causes a 403 sometimes (only on our prod environment, Win Server 2008 R2 running .NET 4.5.1, MVC 5 in a VS2013 project. To resolve I added a name for each route.
  • chdev77
    chdev77 almost 9 years
    This was our fix for Server 2002 and IIS 7. Our lower environments are Server 2012 with IIS 8, we deployed without setting the modules runAllManagedModulesForAllRequests="true". Luckily after getting the 403 many times and more stackoverflow searching I found this thread. So, setting runAllManagedModulesForAllRequests="true" on Server 2002 with IIS 7 solve our problems....and made for a long deployment night.
  • Slight
    Slight over 8 years
    -1 No attempt to explain why the solution works, link itself doesn't even explain it. Bad solution in general (huge performance penalty, not scalable). You should almost never need RAMMFAR other than debugging purposes.
  • MarkKGreenway
    MarkKGreenway over 8 years
    @Slight RAMMFAR only has negative impact on things that would not be delivered via asp.net such as static content other modules. More info : weblog.west-wind.com/posts/2012/Oct/25/…
  • Slight
    Slight over 8 years
    @MarkKGreenway Yes, that's what I was referring to. Is that not what's happening here? With that option on, static files will invoke the pipline no?
  • Spivonious
    Spivonious over 7 years
    This is the real answer. Thanks!
  • Ishmael
    Ishmael over 7 years
    I don't feel this is worth an answer on it's own, but make sure you haven't accidentally added a folder to your site at one of your controller routes :).
  • ValGe
    ValGe about 7 years
    If you are having this a possible root cause is having a different version of an external library in the production environment. I had my mvc app compiled against a newer version of a 3rd party dll and an older version in the production server..
  • Ortund
    Ortund almost 7 years
    @MarkKGreenway you saved my neck. I had ALL of my MVC sites go down and doing this fixed it. A lynch mob was forming but then I found your answer phew! What I'd like to know, though, is what could have changed on my server to make this necessary since all sites were working before...
  • Ortund
    Ortund almost 7 years
    @MarkKGreenway you saved my neck. I had ALL of my MVC sites go down and doing this fixed it. A lynch mob was forming but then I found your answer phew! What I'd like to know, though, is what could have changed on my server to make this necessary since all sites were working before...
  • Luis Villarroel
    Luis Villarroel over 5 years
    Here's to the boy wonder, the kid, the miracle man, the phenomenon, the unstoppable, the king, here's to @Brian Kirkpatrick ladies and gentleman