26
votes

we developed an asp.net mvc 4 application. in vs 2012 this work fine. we publish this web application and putting it on iis 7.5, but when we want to browse web application through iis, this error message was show:

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

we think that this error may be from this web application, but we create another asp.net mvc 4 application (without any change and with internet template) and putting it on iis, and again top error show to us.

we search in the internet and see more poeples that this problem was happened for their. for example in this: 403 - Forbidden on basic MVC 3 deploy on iis7.5 link introduce an idea for solve this problem and assume that this problem was solved for their poeple, but this solution not work for me. another links that we say includes: this https://stackguides.com/questions/6885509/http-error-403-14-forbidden and this: http://yassershaikh.com/http-error-403-14-forbidden-the-web-server-is-configured-to-not-list-the-contents-of-this-directory/ but this solutions not work for me

any idea for solve this problem?

13
Can you check if asp.net is installed on the server and IIS application pool is using the correct version?Srikanth Venugopalan
from where i can find out that asp.net is installed? application pool is set to v4.0Pezhman Parsaee
i add this comment that other asp.net web form application that write in vs 2010 are in this iis and work correctlyPezhman Parsaee
Ok, VS2012 by default sets the targetframework to 4.5. Can you check what is the TargetFramework in your vs2012 solution? Your server might be missing installation of 4.5.Srikanth Venugopalan

13 Answers

42
votes

I had the same problem on a brand new machine, after installing IIS 7.5, Visual Studio etc. I ended up refreshing ASP.NET registration and it worked.

C:\windows\Microsoft.NET\Framework64\v4.0.30319> .\aspnet_regiis.exe -ir C:\windows\Microsoft.NET\Framework64\v4.0.30319> iisreset

HTH

12
votes

First You should register the framework for IIS by executing following command in command prompt as

C:\windows\Microsoft.NET\Framework\v4.0.30319> aspnet_regiis.exe -i C:\windows\Microsoft.NET\Framework64\v4.0.30319> aspnet_regiis.exe -i

If you still get an error as


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


Then probably you need an update for IIS which is used when URLs do not end with a period

Please visit the following link for update http://support.microsoft.com/kb/980368

An update is available that enables certain IIS 7.0 or IIS 7.5 handlers to handle requests whose URLs do not end with a period

8
votes

an update for IIS is solved my problem, that can be downloaded from below link: http://support.microsoft.com/kb/980368

7
votes

This happened to me because I mistakenly ran an unrelated search and replace that renamed the 'id' parameter (3rd line) in Global.asax.cs:

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

...to another name. I immediately started getting 403.14 locally and remotely. Changing it back to 'id' fixed it.

5
votes

Open Elevated Command Prompt in Windows (Run command prompt as Administrator).

And run the command aspnet_regiis -i at the .Net Framework and .Net Framework64 location. Just like below, Here parameter i means install the ASP.NET version 4. The first command is for 32 bit and second is for installing the 64bit version.

C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis -i
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis -i

ScreenshotCommandPrompt

The commands is used to register ASP.NET applications with Internet Information Services (IIS) server.

3
votes

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 the, seemingly unrelated setting, all the symptoms described go away.

Hopefully this fixes some folks.

2
votes

It sounds like the application is not correctly configured. Ensure that your web.config has been deployed, along with all of your application files and that the application pool is configured correctly.

If you access the machine running IIS directly you will likely get a more detail error message.

2
votes

I would comment on @Seth's answer if I had 50 rep. It's not just a search and replace problem. There is a Refactor --> Rename Bug in Visual Studio 2012 that wrongly renamed the "id" inside the literal string value of the url parameter in my RouteConfig.cs. Of course, it's resolved as "won't fix", so be warned.

routes.MapRoute(
            name: "Default",
            url: "{controller}/{action}/{id}",
            defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
        );

was changed to

routes.MapRoute(
            name: "Default",
            url: "{controller}/{action}/{replaced_text}",
            defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
        );
1
votes

In my case the problem was with the Physical Path setting.

It was pointing to C:\inetpub\wwwroot\MySite

but the imported site was actually at C:\inetpub\wwwroot\MySite\Default Web Site\MySite

I changed the path in iis via MySite -> Edit Site -> Basic Settings and I was off to the races.

0
votes

Had the same error (403.14) after copying a working ConnectionString from my web.config on a newer project to replace the ConnectionString on an old project then started doing testing on localdb and received the error. Note: I copied, from new web.config to old web.config, the connectionString portion of the connectionstring only and did not make any changes to the name or providername on the old project. After researching for several hours finally went into one of the attached sqldatasources on the old project (on the design tab in VS 2012) and re-configured the sqldatasource (clicked "configure data source") and in the first dropdown box selected the name associated with one of the recently copied ConnectionStrings. That was all it took to get going and after reconfiguring the ConnectionString it started working. Suspect that when I copied over the ConnectionString from the new project to the old project that the default table specified in the sqldatasource assignment process might have been lost?

0
votes

You need to change application pool for the site:

  • Go to "Actions" panel
  • Then select "Basic Settings"
  • On "Application pool" choose "Select ..."
  • Finally ASP.NET v4.0
0
votes

I had the same error but none of the above solutions worked for me, it ended up that i had .Net 4.6 installed on my development machine, but the project was targeting .net 4.5. I couldn't understand the reason as to why this happened, but nonetheless this thing worked for me.

0
votes

In my case Default Web Site was mapped to a different application. When I was trying to access my app inside Default Web Site I got the 403.14 error.

The solution was to remap Default Web Site to default C:\inetpub\wwwroot.