4

At first I thought my IIS is messed up, so I uninstalled it. Now only have IIS Express. Then I created the default ASP.NET MVC Application and was able to run it successfully with that IIS Express. But when I am following this walk through from Microsoft website to create a WebAPI and a simple HTML page to invoke it,

HTTP Error 403.14 - Forbidden

The Web server is configured to not list the contents of this directory.

is what I get. So It is not my IIS problem but I am not sure how to fix it either.

This is the example I followed, so annoying they can't write a working example in their official website.

https://www.asp.net/web-api/overview/getting-started-with-aspnet-web-api/tutorial-your-first-web-api
Bohn
  • 26,091
  • 61
  • 167
  • 254

1 Answers1

4

This problem occurs because the Web site does not have the Directory Browsing feature enabled, and the default document is not configured.

https://support.microsoft.com/en-gb/kb/942062

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

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 Directory Browsing. In the Actions pane, click Enable.

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.

To do this, 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:directoryBrowse /enabled:true

Fuzzybear
  • 1,388
  • 2
  • 25
  • 42
  • Or simply anonymous authentication hasn't been turned on properly in the IIS website or the website isn't pointing to the correct directory hosting the Web API project. – Steve Nov 30 '16 at 16:39
  • Enabling Directory Browsing fixed it for me. – Bohn Nov 30 '16 at 18:45