Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Directory listing denied on ASP.Net MVC 4 app running in IIS 6 Virtual Directory

I am trying to get ASP.Net MVC 4 working on IIS6 and am running into the always fun Directory Listing Denied error.

Before you start posting about extensionless urls and how I need to read the Haacked blog post.. I have :) So with that out of the way here is the setup:

I have created a new Web Site and configured it to use ASP.Net 4.0. I had to do this because the existing Default Web Site is configured for ASP.Net 2.0 and this breaks extensionless urls. Under the new web site I created a Virtual Directory with Read/Write/Log Vists/Index this resource options selected and execute permissions set to Scripts.

I have verified that ASP.Net v4.0.30319 is in the Web Service Extensions list and is allowed. I have also verified that the .axd mapping is setup correctly in my virtual directories mapping configuration.

I am completely and totally stumped..

As a side bit of trivia I had this working with the web site pointing directly at my ASP.Net 4 web app but we need this to be done via a virtual directory instead. The fact I had this working should mean that the EnableExtensionlessUrl registry setting is not a problem.

like image 564
Shane Courtrille Avatar asked Mar 08 '12 17:03

Shane Courtrille


2 Answers

I had faced the same problem and it got cleared when I added "Wildcard application mapping" (.*) to aspnet_isapi.dll with unchecked option "Verify that file exists"

Application -> Properties -> Directory -> Configuration -> Mappings -> Insert -> Browse to C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll -> Uncheck "Verify that file exists" -> Ok

Now the site is opening fine without any issues.

like image 87
Indomitable Avatar answered Sep 28 '22 03:09

Indomitable


Similar issue: We installed MVC4 on an IIS6 box, set up everything as described, and got same error:

Directory Listing Denied
This Virtual Directory does not allow contents to be listed.

For us, the final fix was to add the UrlRoutingModule to the web.config:

  <add name="UrlRoutingModule"
       type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

Which makes sense, but I don't know why we needed to explicitly add it and others didn't. (We are running in a directory under Sharepoint, maybe related...)

like image 24
Scott Stafford Avatar answered Sep 28 '22 03:09

Scott Stafford