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?
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 :)
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
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.
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
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
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
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>
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.
I faced a similar (but not identical) issue.
https://i.stack.imgur.com/ThVrB.png
Then it worked for me.
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);
}
}
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.
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...
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.
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
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.
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 :)
IUSR permissions
use on a folder if not under inetpub/wwwroot will be solution for some.
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.
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.
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.
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.
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.
Success story sharing