How to enable Directory browsing by default on IIS Express
Asked Answered
D

4

22

Cassini (Visual Studio development web server) by default enables directory browsing, how can I enable directory browsing on IIS Express by default? (I don't want to have a separate configuration for each project I have?

Dinsmore answered 17/12, 2011 at 9:16 Comment(0)
F
20

You should be able to use AppCmd.exe to manage IIS Express. Try this:

appcmd set config /section:directoryBrowse /enabled:true

More info on AppCmd.exe here: http://learn.iis.net/page.aspx/114/getting-started-with-appcmdexe

Freshet answered 17/12, 2011 at 17:18 Comment(4)
Be an admin run this %systemroot%\system32\inetsrv\appcmd set config /section:directoryBrowse /enabled:trueTerryl
I had to run the copy of appcmd that lived in `%programFiles(x86)%\IIS Express` . If I ran the other copy, the setting would not take. I guess I have 2 versions of IIS installed. forums.iis.net/post/1993018.aspxDudgeon
@WalterStabosz Thanks for that comment. I got this to work, by following your comment.Endbrain
ERROR ( hresult:80070020, message:Failed to commit configuration changes. The process cannot access the file because it is being used by another process.Frear
H
32
  1. Go to Web.config file of your project.

  2. Add the below two tags in <system.webServer> tag in web.config

<directoryBrowse enabled="true" />

<modules runAllManagedModulesForAllRequests="true" />

Hydromagnetics answered 16/3, 2017 at 17:48 Comment(3)
This one worked for me for Visual Studio 2017 (info! do not forget to create <system.webServer> tags in web.config, because they are not there)Crocker
Thanks!! This saved my day. Worked for me Visual Studio 2017.Chronister
@Moni: Can you advise little more on your answer? After adding advised elements in web.config my web api application listed directory structure. Should not it had run with a default controller at first place?Lysenko
F
20

You should be able to use AppCmd.exe to manage IIS Express. Try this:

appcmd set config /section:directoryBrowse /enabled:true

More info on AppCmd.exe here: http://learn.iis.net/page.aspx/114/getting-started-with-appcmdexe

Freshet answered 17/12, 2011 at 17:18 Comment(4)
Be an admin run this %systemroot%\system32\inetsrv\appcmd set config /section:directoryBrowse /enabled:trueTerryl
I had to run the copy of appcmd that lived in `%programFiles(x86)%\IIS Express` . If I ran the other copy, the setting would not take. I guess I have 2 versions of IIS installed. forums.iis.net/post/1993018.aspxDudgeon
@WalterStabosz Thanks for that comment. I got this to work, by following your comment.Endbrain
ERROR ( hresult:80070020, message:Failed to commit configuration changes. The process cannot access the file because it is being used by another process.Frear
C
6

you can use appcmd tool

APPCMD (command) (object-type) <identifier> < /parameter1:value1 ... >*

Where is one of the commands supported by .Most objects support this basic set of commands:

LIST Display the objects on the machine. An optional can specify a unique object to list, or one or more parameters can be specified to match against object properties.

ADD Create a new object with the specified object properties to set during creation.

DELETE Delete the object specified by the .

SET Set parameters on the object specified by .

Enable directory browsing.

Go to the IIS Express install directory.

1: Enable directory browsing at the server level

Run `appcmd set config /section:system.webServer/directoryBrowse /enabled:true`

2: Enable directory browsing at the site level

Run `appcmd set config ["SITE_NAME"] /section:system.webServer/directoryBrowse /enabled:true`

Note: Run with elevated permission

you can verify that the configuration/system.webServer/directoryBrowse@enabled attribute is set to true in the site or application configuration file.

Reference : IIS

Complexioned answered 17/12, 2011 at 9:17 Comment(0)
I
2

for those coming across this years later: directory browsing can also be enabled via IIS Manager:

IIS Manager Directory Browsing

Inger answered 4/9, 2018 at 14:4 Comment(1)
Thanks. That's precisely what I needed for a project folder on my localhost.Augustaaugustan

© 2022 - 2024 — McMap. All rights reserved.