1

Possible Duplicate:
MVC4 HTTP Error 403.14 - Forbidden

Every time I have to configure a ASP.Net mvc application I come across the same error:

HTTP Error 403.14 - Forbidden
The Web server is configured to not list the contents of this directory.

There is a reason this might happen and I have figured it out.

Configured app pool to use LocalSystem account. Added permission for this user in the project folder.

Today another application with this problem and only changing the application pool to use LocalSystem account was not enough. What could I do to solve this problem.

P.S: In Asp Net mvc we do not enable browser directory on IIS so I don´t understand why the problem.

Community
  • 1
  • 1
Guilherme Longo
  • 2,278
  • 7
  • 44
  • 64

1 Answers1

5

You are seeing this error precisely because you do not allow directory browsing. What this is showing you is that MVC has not picked up on the request and IIS is attempting to find the default document. I have answered a question similar in the past, maybe some of these suggestions will help you discover your problem

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

  • You have setup the website as an application in IIS You have .NET 4.5 installed on the server
  • You have set the application pool to run the proper version of the .NET framework (ie. it is not set to .NET 2.0
  • You are using the integrated pipeline on your application pool .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

Also, check your web.config and ensure that this line exists:

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

Update

Well I certainly did not expect this much attention on my answer... With that said, I can expand a little more on the conversation below. DarinD is expressing concern that the

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

is a additional burden on your web server, and he is correct. This line will cause IIS to load all modules for any request, including static files. With that said, given the aspects of IIS 7 such as kernel caching, unless you are hosting a very high traffic site/have tons of modules, then the performance impact will most likely not be noticed by you or your users.

If you want to view a potentially different solution, please check out this blog post for more information on the managedModule line above and you can test if the solution posed there fixes your problems as well.

Lastly, here is a blog post that covers not only the potential performance impacts, but goes deeper into how routing works and what you need to do to get extensionless URLs routing on IIS 6 and 7 (which should cover 7.5 as well)

Community
  • 1
  • 1
Tommy
  • 39,592
  • 10
  • 90
  • 121
  • 2
    I wouldn't recommend setting `runAllManagedModulesForAllRequests="true"` at all. That would cause all requests, even those to static resources such as javascript, css and images, go through the managed pipeline which obviously comes with a performance overhead. – Darin Dimitrov Jan 23 '13 at 20:59
  • 2
    You shouldn't just parrot another answer on SO. If it is a duplicate question, the question should just be closed. – John Koerner Jan 23 '13 at 21:00
  • - Solved my problem. Thanks – Guilherme Longo Jan 23 '13 at 21:01
  • Completely agree with @JohnKoerner, things get even even worse when the answer is preaching bad practices such as setting `runAllManagedModulesForAllRequests="true"`. – Darin Dimitrov Jan 23 '13 at 21:01
  • If this answer is the wrong approach, what's the right approach? – Jack Marchetti Jan 23 '13 at 21:26
  • @JackMarchetti, the right approach to do what? – Darin Dimitrov Jan 23 '13 at 21:40
  • Oh sorry for annoying you guys. Next time you ask a question I will remember that and definitely restrain myself from commenting and expression my opinion on what I consider to be good and bad practices. I just wanted to point it out so that other people having the same problem as you do not do the same mistake as you did and by mistake set `runAllManagedModulesForAllRequests="true"`. – Darin Dimitrov Jan 23 '13 at 22:48
  • @GuilhermeLongo - to help ease concerns in the comments, please check my update. I am glad your project is working, but the guys above are correct in that going forward, you may need to alter this slightly to potentially gain better performance – Tommy Jan 23 '13 at 23:01