9

After finishing the John Papa course on Pluralsight- which is AWESOME by the way!!!)

I'm now creating my first SPA. I come from Desktop Application Developer background so excuse me if this question is newbie!

When I load the SPA instead of seeing the splash screen and then the main screen I'm getting this error message:

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

A default document is not configured for the requested URL, and directory browsing is not enabled on the server.

Can anyone help fix this?

rae1
  • 6,066
  • 4
  • 27
  • 48
EdsonF
  • 2,719
  • 3
  • 30
  • 34
  • 2
    That error is normally seen when you're landing within a directory\folder rather than on the page itself. Whats the URL in the browser when you launch the SPA? – X3074861X Apr 04 '13 at 16:42
  • set the default document in the webconfig – Evan Larsen Apr 04 '13 at 19:42
  • 2
    @X3074861X and Evan Larsen Thanks for your response I've fixed the issue by changing the web.config to have the following: previously value was equal false Thanks once again guys! – EdsonF Apr 05 '13 at 10:04
  • Even if you set up the web.config right, you still need to add the Windows Features to support them. – Suncat2000 Sep 27 '17 at 19:44

5 Answers5

17

1.Open up IIS Manager.

2.Add the website by right clicking on "Default website" and choose "Add application".

3.Enter any name as alias type and the load that website in the physical path and click OK.

4.Then go to the Features View of that Loaded Website and double click on the "Directory Browsing".

  1. Click on "Actions" work space and change the "Disable" state to "Enable" state.

6.Then Refresh the Default Website.

7.Open the Visual Studio and go to that website. it will ask for reload , then click "yes".

8.it will add the following code in the web.config file.

 <system.webServer>

    <directoryBrowse enabled="true" />

 </system.webServer>

9.Now run and see the error will disappear.

V-SHY
  • 3,925
  • 4
  • 31
  • 47
r pattanaik
  • 186
  • 1
  • 4
  • I solved my problem by ensure the Directory Browsing which is showed by @Lijo Varghese and adding your web.config code. – V-SHY Jun 24 '15 at 09:26
7

Go to Control panel--> Program and Features --> Turn widows features on or off (on the left side of windows).

Windows features Box will pop up in this : IIS --> WWW services --> Common HTTP Request --> Directory Browsing (Enable this).

click OK.

In your web.config file - add this,

<system.webServer>
  <defaultDocument enabled="true" />
</system.webServer>

and save.

It will start working. It worked for me after facing some initial glitches.

Dark Falcon
  • 43,592
  • 5
  • 83
  • 98
Lijo Varghese
  • 71
  • 1
  • 1
  • Hell Yes , That is the Answer , Cause We must not need to change some sort of settings for ııs to look up files inside a directory. It should have already been open by default so this is not a setting this is a functionality and the problem occurs beceuse IIS Express (Litest version) do not bother to search file destination if it is referenced with link tags etc. I thinks yours is the right answer – yigitt Jul 15 '16 at 15:10
5

I was able to fix this using the answer from this site: https://devstuffs.wordpress.com/2012/02/29/how-to-fix-http-error-403-14-forbidden-the-web-server-is-configured-to-not-list-the-contents-of-this-directory/

This error occurs when you have MVC 2+ running hosted on IIS 7+, this is because ASP.NET 4 was not registered in IIS. In my case I was creating a MVC 3 project and hosting it on IIS 7.5.

To fix it, make sure you have MVC 2 or above and .Net Framework 4.0 installed, then run a command prompt as administrator and type the following line:

32bit (x86)

%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -ir

64bit (x64)

%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -ir

Jake
  • 4,014
  • 8
  • 36
  • 54
  • Thanks for the solution, and this worked for me, for mcv applications this is the solution that works. – fizmhd Oct 10 '16 at 05:26
  • 1
    I removed and reinstalled IIS on Windows 10 but had to explicitly add Windows Features for Application Development ASP.NET, ISAPI, and .NET Extensibility 3.5 and security before IIS responded to ASP.NET configuration settings. `aspnet_regiis.exe` apparently doesn't work in Windows 10. – Suncat2000 Sep 27 '17 at 19:43
2

This is also one reason when this error appears.

Newbie programmers forget to mention the start page. Right Click on any form which you want to be displayed first when applications runs and Set as StartPage you wil find in the drop down menu.

Miank
  • 105
  • 3
  • 13
1

Edit your web.config and add customErrors section in order to display detailed errors from your web server. Use mode="Off" http://msdn.microsoft.com/en-us/library/h0hfz6fc%28v=vs.71%29.aspx

      <configuration>
        <system.web>
           <customErrors mode="Off">         
           </customErrors>
        </system.web>
      </configuration>

Another option is to try to run the SPA in separate browser like Chrome typing the url directly, instead of running the SPA application in the Visual Studio debugger. URL should be something like "localhost:13753". Check the port number of your development server. It will be different.

Then open the Developer tools by pressing F12.

Hit Ctrl+R to refresh and investigate the Netwok Tab. You can usually find more information about the error and what is causing it.

mitaka
  • 2,159
  • 1
  • 30
  • 30