166
votes

I just created a new empty website in Visual Studio 2012 and clicked on run (i.e view in browser) and I get this error :

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

I went into IIS and clicked on Directory browsing and then ensured that Directory browsing was enabled but I still get this error. I can't figure it out ?

The website project I just created is not listed in Default web sites in IIS Manager which I thought was odd.

How do I get rid of this error ?

27
Is the project configured to use IIS? Or IIS Express? Or Casini?Kris Vandermotten
Did you run or view in browser? 2 different things. If this is an MVC project, then you might have tried to view a view in a browser?christiandev
Please make sure that you enabled ASP.NET 4.5 or ASP.NET from Control Panel\All Control Panel Items\Programs and Features\Turn Windows Features on or off\Internet Information Services\World Wide Web Services\Application Developement Features\ASP.NET 4.5 or ASP.NET 3.5 depending upon your Application pool settings.Bimal Das

27 Answers

151
votes

keep this into your web config file then rename the add value="yourwebformname.aspx"

<system.webServer>
    <defaultDocument>
       <files>
          <add value="insertion.aspx" />
       </files>
    </defaultDocument>
    <directoryBrowse enabled="false" />
</system.webServer>

else

<system.webServer>
    <directoryBrowse enabled="true" />
</system.webServer>
46
votes

This problem occurs because the Web site does not have the Directory Browsing feature enabled, and the default document is not configured. To resolve this problem, use one of the following methods. To resolve this problem, I followed the steps in Method 1 as mentioned in the MS Support page and its the recommended method.

Method 1: Enable the Directory Browsing feature in IIS (Recommended)

  1. Start IIS Manager. To do this, click Start, click Run, type inetmgr.exe, and then click OK.

  2. In IIS Manager, expand server name, expand Web sites, and then click the website that you want to modify.

  3. In the Features view, double-click Directory Browsing.

  4. In the Actions pane, click Enable.

If that does not work for, you might be having different problem than just a Directory listing issue. So follow the below step,

Method 2: Add a default document

To resolve this problem, follow these steps:

  • Start IIS Manager. To do this, click Start, click Run, type inetmgr.exe, and then click OK.
  • In IIS Manager, expand server name, expand Web sites, and then click the website that you want to modify.
  • In the Features view, double-click Default Document.
  • In the Actions pane, click Enable.
  • In the File Name box, type the name of the default document, and then click OK.

Method 3: Enable the Directory Browsing feature in IIS Express

Note This method is for the web developers who experience the issue when they use IIS Express.

Follow these steps:

  • Open a command prompt, and then go to the IIS Express folder on your computer. For example, go to the following folder in a command prompt: C:\Program Files\IIS Express

  • Type the following command, and then press Enter:

    appcmd set config /section:system.webServer/directoryBrowse /enabled:true

32
votes

Go to cmd and type this:

for x64 O.S: %windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -ir

for x32 O.S: %windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -ir

This will install the right version and IIS will understand the MVC directory browsing

27
votes

There can be multiple reasons for the issue. One that worked for me on IIS 8.5 was as follow

Steps

  1. Type "turn windows features on or off" in search.
  2. Click on "Add Roles and features" in Server Manager.
  3. In Wizard scroll down to the Web server and select : Web Server -> Application Development. Select all except CGI from the list as shown in the screen shot

enter image description here

  1. Finally hit next and Install.
  2. Restart IIS

Your website may start working.

19
votes

Set a start page.

When I had this problem, I went into the solution explorer, found the page I wanted to see first (in my case "Home.aspx), right clicked on it and selected "Set As Start Page." This fixed my issue (which sounded really similar to yours). This was in Visual Studio 2012 Professional and I ran it in Firefox.

18
votes

I just pasted this code snippet inside web.config file and the error was solved.

<system.webServer>
    <directoryBrowse enabled="true" />
</system.webServer>
17
votes

Try to add the following settings to web.config file.

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

Control Panel > Turn Windows Features on or off

Internet Information Services > World Wide Web Services > Application Development Features

Enable the two options

.NET Extensibility 3.5
.ASP.NET 3.5

enter image description here

11
votes

I have one quick remedy for this. In fact I got this error because I had not set my web page as start page. When I did my web page(html /aspx) as set start page as shown below I got this error corrected.enter image description here

I don't know whether this solution will help others.

9
votes

On the site in IIS:

  1. select 'Advance Settings'
  2. Then for application pool choose "ASP.NET v4.0"

image for example

8
votes

Empty website template creates an ASP.NET website that includes a Web.config file but no other files. Means you have not any default page to show on browse or run.

This error message simply means that you did not setup and configure the default document properly on your IIS.

Once this is configured, the error message will go away.

6
votes

Problem

Error: 403.13 when running WebForms ASP.Net website from Visual Studio.

Solution

Access to the root is denied: http://localhost:51365

Navigate to the Login page or any page that exists and it will work:

http://localhost:51365/Login.aspx

6
votes

I solved my problem with fallow this steps =>

  1. Open IIS Manager
  2. Click the Application
  3. Click Directory Browsing
  4. Click Open Feature (On the right you will see under Actions)
  5. Click Enable
5
votes

For my case, I received the same error after creating an empty Web Api project.

I solved it by editing RouteConfig.cs in the App_Start folder :)

I replaced the line of code reading :-

defaults: new { action = "Index", id = UrlParameter.Optional }

with the following :-

defaults: new { controller = "Index", action = "Index", id = UrlParameter.Optional }

Notice I just had to specify the Controller whose index action I would like to invoke first.

Well all the above responses didn't solve my case (as I wanted) e.g.

  • Enabling directory browsing from web.config just listed all files and folders in my project just like php would do when you don't have an index file
  • Setting defaultDocument also didn't work for me somehow still got the HTTP Error 403.14 (Still have no idea why)

If there may be anyone in similar circumstances as mine then give this a try.

5
votes

I was getting this error and change the Application Pool Managed Pipeline Mode to "Integrated" solves the problem.

Source: Running a .NET 4.6 MVC application on IIS 8.5 (Windows Server 2012)

4
votes

In my case, I experienced this error because my webapp was .NET v4, and the application pool was configured for .NET v2.

Double-clicking on the application pool brings up a popup window, where we can select the desired version of .NET Framework.

4
votes

SOLVED
Search "Windows Feature" on start ->
Click "turn features on and off" ->
Expand "Internet Information Services" and
Check every progrm in every subfolder and
Click "OK"
This will fix all your problems. enter image description here

3
votes

The problem may come from running the project from visual studio on IIS while being on the wrong opened tab on visual studio, so the solution is either opening the right tab (the webform you want to test on your browser) or as others suggested in the other answers, right click on the webform that you want to set as a homepage then click on 'Set As A Start Page'.

2
votes

This can be caused by a bum applicationhost.config entry.

Stop IIS Express if it's running (right-click the light-blue scroll-thingy icon in the Windows System Tray; Exit).

Go to your project's Properties > Web, and check that the Project Url is correct. In case of an https url, make sure it includes a port number in the valid range. A correct URL could be: https://localhost:44300/. Now press the "Create Virtual Directory"-button next to the URL. This adds a new entry to applicationhost.config.

Start the project again and hopefully you will no longer get the error.

2
votes

I'm sure after years you probably have an answer already. But in case someone else is looking for an answer in the future.

For my problem, I didn't have to at anything to the web.config. I didn't think I would need to either as it was working previously.

Make sure no folder is named the same as your page, I had a folder called "blog" and a page named "blog.aspx", it was trying to load the folder, I noticed this in the link, changed the folder to blogContent, now it loads fine.

I'm posting a copy here as you're the first in the search query.

2
votes

In my case

In Application Pool i set .NetFrameWork version to V4.0 and solved problem ....

2
votes

You should install Application Development part of IIS on your server as you may see in this picture:enter image description here

1
votes

In my case I was missing the Microsoft.Owin.Host.SystemWeb nuget.

1
votes

right click on your project in solution explorer and then click add new item, add a HTML page and name it as index.HTML after all rerun your application

0
votes

This could happen for any number of reasons. If you have tried through all of the above and still getting the same error, I have one more solution.

Another reason this could happen is that

  1. If you have the same code base running before you started to run the fresh solution, you might encounter this error. The reason is that IIS Express is trying to run on the same port as it was for the old solution which has the physical path registered for the application start URL.
  2. Since the IIS cannot figure out the physical path to run the solution, it might not be able to locate all the dlls required to start the application.

Solutions:

  1. Try to change the application port to default. For example., Use http://localhost/ instead of http://localhost:25836/

  2. Try changing to any other port if you have already used the default port for the previous application. ex: http://localhost:25364/ instead of http://localhost/

This will allow the IIS/IIS Express to point to the default bin path of the newer application you are trying to run which will have all the required dlls to start the application.

0
votes

I open one old Asp.net webform (.Net Framework4.5)solution with Visual Studio 2019, has same issue. The solution quite simple, go to web project's properties-> Web-> checked "Override application root URL" -> assign another port number. Save the solution and run in debug mode again. Problem resolved.

0
votes

So this means the server can't process what you doing. (if you wanna use the index kinda thing ignore this answer)

For example, if you are instaling WordPress on windows iis, the server should be able to run .php files.

otherwise you will get these kinds of issues. So if it WordPress you can resolve that issue by installing PHP on that server using iis manager -> web platform installer.

enter image description here