0

I'm using simple ASP MVC project as WebServer for android app. when running project with IIS Express, All Actions is working but when running with local IIS, this error will appear

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.

When enabled Directory Browsing, list of folders and files is shown. according this link, when adding the <modules runAllManagedModulesForAllRequests="true" /> to <system.webServer> section in web.config, this error will appear:

Module     IIS Web Core
Notification       BeginRequest
Handler    Not yet determined
Error Code     0x80070021
Config Error       This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false". 

My IIS Version : 10 .Net : 4.5.2

Reza Y
  • 9
  • 3
  • Why did you enable directory browsing? What do you need that for? – mason Oct 30 '20 at 13:05
  • I did this based on the first error message – Reza Y Oct 30 '20 at 14:48
  • That doesn't make sense. Just because the error describes that you can enable directory browsing doesn't mean you should. It's likely not needed for an ASP.NET MVC app. Instead, you need to figure out why the HTTP requests aren't hitting your routing in your app. Is the app pool correctly enabled for .NET managed runtime? Is ASP.NET installed on the server? – mason Oct 30 '20 at 14:57
  • I'm stupid, when checking IIS in windows features most manually check ASP.NET and i had forgotten. Thanks – Reza Y Oct 30 '20 at 18:29

1 Answers1

0

To resolve the issue you can follow the below steps:

1)Open up "Turn Windows Features on or off"

2)Under Application Development choose .NET Extensibility 4.5, ASP.NET 4.5, and both ISAPI entries

enter image description here

click ok and finish the installation.

after doing these changes restart iis server.

Jalpa Panchal
  • 8,251
  • 1
  • 11
  • 26