ChatGPT解决这个技术问题 Extra ChatGPT

HTTP 错误 403.14 - 禁止 Web 服务器配置为不列出内容

I have downloaded the MVC Music Store ASP.NET application at location C:\Users\DEVESH\Desktop\Projects\MvcMusicStore-v3.0\MvcMusicStore-Completed\MvcMusicStore and added the website on IIS at the same location. I have also given permission to IIS_IUSRS, but when I run localhost I am getting the error:

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

I have googled it, but have not found a fix. What I am doing wrong?


D
Daniel Persson

I came across this error because I had the wrong .NET version (v2.0 instead of v4.0) configured on the web site application pool. I fixed it this way on Windows Server 2008 R2 and IIS 7. I'm pretty sure the instructions apply to Windows Server 2012 and IIS 8 as well:

Press keys Windows+R to open the Run dialog, type inetmgr and then click OK. This opens the IIS Manager.

In the left treeview, locate the Sites node and find the Default Web Site node under it (or the name of the site where the error message appears).

Right-click the node and select Manage web site -> Advanced settings.... Note the name of the value Application pool. Close this dialog.

In the treeview to the left, locate and select the node Application pools.

In the list to the right, locate the Application pool with the same name as the one you noted in the web site settings. Right-click it and select Advanced settings...

Make sure that the .NET Framework version value is v4.0. Click OK.

This doesn't apply if you're running an older site that actually should have .NET v2.0, of course :)


.NET Framework version value changed to v4.0 as by default it will be 2.0. It works, Great!!
Check this also Enable the Directory Browsing feature in IIS support.microsoft.com/en-us/kb/942062
@BinoMathewVarghese how can this work? You are enabling directory browsing. It lists down the files. Doesn't show the actual website.
I don't have "inetmgr".
@AndrewKoster I haven't got it either on my current W10 installation, it seems you need to activate it: stackoverflow.com/questions/30901434/iis-manager-in-windows-10
R
Ruslan_K

In my case ASP.NET not registered on server. try to execute this in command prompt:

Windows 32bit

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

Windows 64bit

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

Running this command in my case returns 'This option is not supported on this version of the operating system. Administrators should instead install/uninstall ASP.NET 4.5 with IIS8 using the "Turn Windows Features On/Off" dialog' I used 'Turn Windows Features On/Off' to add Internet Infomation Services - World Wide Web Services - Application Development Features - ASP.NET 4.7 and it works! Nice :)
You're most likely to run into this scenario (like I just did) when you have .NET 4.5+ installed (current as of this writing) then retroactively install a version of IIS that predates .NET 4.5, like IIS 7 (somewhat dated as of this writing) that comes for free on Windows 7 under "Turn Windows features on or off".
In case you are trying this on windows server OS, you will need to do it using Server Manager --> Manage --> Add roles and features then follow the wizard to select Web Server (IIS) --> Web Server --> Application Development --> ASP.NET 4.5
For those with @LukášKmoch issue, .net 4.5 needed installed. This article worked for me docs.microsoft.com/en-us/iis/get-started/whats-new-in-iis-8/…
A
ATHER

Just in case if anyone reached here looking for solution, here is how i resolved it. By mistake I deleted all files from my server ( bin directory ) but when i recopied all files i missed App_global.asax.dll and App_global.asax.compiled files. Because these files were missing IIS was giving me this error

403 - Forbidden: Access is denied.

As soon as i added these files, it started working perfectly fine.


L
Luke Zaparaniuk

I resolved this issue by correcting an error with my Global.asax file arrangement. I had copied across the files from another project and failed to embed the Global.asax.cs within the Global.asax file (both files previously existed at the same level).

https://i.stack.imgur.com/vtSyP.png


This "embedding" occurs naturally, without you doing anything. If you look at the files on disk, you'll see they're in the same folder.
V
VivekDev

In my case when I browsed to site5.com I got the following error.

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.

And then when I browsed to

site5.com/home/index

I was met with

HTTP Error 404.0 - Not Found The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

Most likely causes: The directory or file specified does not exist on the Web server. The URL contains a typographical error. A custom filter or module, such as URLScan, restricts access to the file.

All that I did is installed the feature in IIS ASP.NET 4.8 as shown below.

https://i.stack.imgur.com/ZbPyN.jpg


P
Priyank Agarwal

I was using ASP.NET 4.5 MVC application on IIS 7. My fix was to set runallmanagedmodule to true.

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

or If you have other modules, you may want to add them inside the module tag.

<system.webServer>
    <modules runAllManagedModulesForAllRequests="true">
             <add name="ErrorLogWeb" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" />
             ...
    </modules>
</system.webServer>

IIS Modules Overview : The Official Microsoft IIS Site


D
David Bennington

I have encountered similar myself before for 2 reasons; 1. MVC is not installed. 2. The url routing module is not registered (this varies by machine in my workplace for a reason I cannot fully explain - it is not always registered at a system level ), try registering it in the application web.config:

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

Edit: I forgot to add the location for iis 7+:

<system.webServer> 

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

J
Jon Schneider

This error can happen when, in IIS Manager, the ASP.NET MVC site is pointed to the wrong directory.

In my case, I inadvertently had the site pointed to the solution directory instead of the child project directory. That is, I had the site's Physical path set to

C:\dev\MySolution

instead of

C:\dev\MySolution\MyProject.

Specific steps to fix this:

Open IIS Manager (Start > Run > inetmgr); In IIS Manager, in the left pane, expand Sites; Under Sites, left-click the ASP.NET MVC website; In the right pane, click Basic Settings...; In the Edit Site dialog, change the Physical path to the project directory. Click OK.


E
EJoshuaS - Stand with Ukraine

I faced a similar (but not identical) issue.

https://i.stack.imgur.com/ThVrB.png

Then it worked for me.


J
John

I've just had the same problem, but my fix was that the Routing was not configured in the Global.asax.cs file. I'm using Bootstrapper and Castle Windsor, so to resolve this problem I added the following code to Global.asax.cs:

public class MvcApplication : System.Web.HttpApplication
    {
        protected void Application_Start()
        {
            Bootstrapper.IncludingOnly.Assembly(Assembly.GetAssembly(typeof(WindsorRegistration)))
                .With
                .Windsor()
                .With
                .StartupTasks()
                .Start();
        }
    }

Obviously if you are using the basic MVC then you will need to reference the RouteConfig file in the AppStart folder instead:

public class MvcApplication : System.Web.HttpApplication
    {
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
        }
    }

r
rns

In my case, i had multiple projects but i had not defined the starting Project. So this error was generating. After defining the startUp project solved the issue.


H
Hüseyin Yağlı

This error occurs when the application cannot startup. So the cause can be anything that prevents your application to start.

Wrong connection string

Wrong IIS directory permissions

An exception thrown in your Application_Start() function

IOC Container initialization error

IIS ASP.NET registration errors

Missing DLL in your bin folder

etc...


l
live-love

I had this error after creating an empty ASP.Net application in Visual Studio. As soon as I added a file index.html to the main solution, it worked. So in my case, I just needed to add a file to the root of the project folder.


B
Bino Kochumol Varghese

Check this also:

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:

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

Method 2: Add a default document Method

Method 3: Enable the Directory Browsing feature in IIS Express

LINK : https://support.microsoft.com/en-us/kb/942062


You're right. Sorry. I down voted it because the user has downloaded and is trying to deploy an application. There is no point in allowing a user to browse the files that make up an application. In fact, rarely is it a good thing for the user to browse the folders and files of a web site. So... the user is really trying to get the application to work not allow anyone to browse the folder structure.
this is a somewhat solution to that mentioned problem. And windows recommending the same. I tried the above solution to my project and worked, maybe the different scenario but the solution will help to solve the error.
A
Ahmet Arslan

If project is a ASP.net MVC project it would be about routing. In my case I changed default routing values:

routes.MapRoute(
           "Default",                                              
           "{controller}/{action}/{id}",                           
           new { controller = "Home", action = "Index", id = "" }  
       );

I changed my code accidentally to:

routes.MapRoute(
               "Default",                                              
               "{controller}/{action}/{JobID}",                           
               new { controller = "Home", action = "Index", id = "" }  
           );

Thats I only changed "id" to "JobId" and default route can not be find.


A
AtiKa Bhatti

In my case index.aspx file was not created by default and after adding another web form i did not set the form as start page ...After setting the page as start page my issue get resolved . So right click a web form and set the form as start page :)


T
Tom Stickel

IUSR permissions use on a folder if not under inetpub/wwwroot will be solution for some.


S
Sujay Paranjape

In my case, I had to disable 'Exclude files from the App_Data folder' in my publish profile to deploy the App_Data folder with my XML documentation (XmlDocument.xml). That got rid of the 403.14.


P
Penny

in my case: 1. in IIS Manager, in left tree, left click the computer name, in right dialog click ISAPI and CGT limitation, in open dialog, select ASP.NET v4.0.30319 and select enable. There is two ASP.Net v4.0, one for 32bit, another for 64 bit. select depending on your OS bit. 2. in left tree select app pool, in right dialog, select the app pool your website used. double click that pool, in open dialog, .net framke item select .net framework v.4.0.30319. and pipe..item select integate. Maybe there is some wrong translation above because my OS is not English version.


c
codeMonkey

In case anyone comes across this for a project other than MVC:

My project was a WCF project, which runs off .svc files--no default document. As a result I got a 403.14 error at myhost.com/ but as soon as I added a baseAddress path from my web.config file (ex. myhost.com/mybaseaddresspath.svc I got a webpage.


T
The Red Pea

My colleagues made a URL Rewrite rule, which reduced all URLs to a StaticFileHandler; mapped to a file path at the root of my Application physical folder.

(i.e. an over-aggressive URL rewrite means that my Controllers/Actions were not working)

Check your applications' URL Rewrite rules to confirm they do what you expect.


u
user10922241

I faced similar issue. My controller name was documents. It manages uploaded documents. It was working fine and started showing this error after completion of code. The mistake I did is - Created a folder 'Documents' to save the uploaded files. So controller name and folder name were same - which made the issue.


关注公众号,不定期副业成功案例分享
关注公众号

不定期副业成功案例分享

领先一步获取最新的外包任务吗?

立即订阅