The issue HTTP Error 403.14 – Forbidden The Web server is configured to not list the contents of this directory when I tried to deploy my ASP.NET website on IIS for the first time. Actually, this issue is not a problem for my web application to work on IIS. There is one more issue or configuration which was needed to resolve for my web application to work on IIS.
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.
Things you can try:
If you do not want to enable directory browsing, ensure that a default document is configured and that the file exists.
Enable directory browsing using IIS Manager.
Open IIS Manager.
In the Features view, double-click Directory Browsing.
On the Directory Browsing page, in the Actions pane, click Enable.
Verify that the configuration/system.webServer/directoryBrowse@enabled attribute is set to true in the site or application configuration file.
Detailed Error Information:
Error Code 0x00000000
Requested URL http://localhost:81/
Physical Path E:.Net Devops\Publish
Logon Method Anonymous
Logon User Anonymous
This error occurs when a document is not specified in the URL, no default document is specified for the Web site or application, and directory listing is not enabled for the Web site or application. This setting may be disabled on purpose to secure the contents of the server.
If you read the error details, it’s clearly mentioned that we need to enable the Directory Listing in IIS along with other suggestions. Enabling the Directory Listing is one of the solutions. Due to security concerns, it will be disabled by default.
One more thing we can notice is that it is complaining there is no default document configured or its not exist. So IIS web server looking for a default file when an HTTP request comes to cater to that.
The first solution which comes to mind is to enable the Directory Listing in IIS Manager. So I tried to enable Directory Listing in IIS Manager to solve this issue first.
To enable Directory Listing, we are supposed to go to our website in IIS Manager and then we can find Directory Browsing with Icon as shown below screenshot
When you go to the Directory Listing option, we can find whether it’s Enabled or Disabled as shown below screenshot. In my case, it was not Enabled.
Once Directory Browsing was Enabled, still my application was not working and it was showing only my files.
This did solve my issue, but my asp.net application was not working only I could see files listed in the browser.
If you are facing this issue while deploying the ASP.NET application on IIS and the application not running then Enabling Directory Browsing is not required, please refer to this article for complete details Website shows only files and not the Website on IIS
Sometimes Error Description will not be appropriate to solve the actual problem, in my case I wanted to run my ASP.NET application on IIS. But the issue was described as I was supposed to enable Directory Browsing. But we can enable and try whether it solves the problem. As per this article, I could solve the Directory Browsing issue.
Enabling Directory Browsing is not recommended as it compromises security.