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?
4 Answers
- Go to - Web.configfile of your project.
- Add the below two tags in - <system.webServer>tag in- web.config
<directoryBrowse enabled="true" />
<modules runAllManagedModulesForAllRequests="true" />
- 
                    1This one worked for me for Visual Studio 2017 (info! do not forget to createtags in web.config, because they are not there) – Erdinc Ay Sep 07 '17 at 08:09
- 
                    Thanks!! This saved my day. Worked for me Visual Studio 2017. – luckyShubhra Sep 16 '17 at 09:05
- 
                    @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? – Binoy Sep 07 '18 at 21:16
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
 
    
    - 1,281
- 13
- 15
- 
                    3Be an admin run this %systemroot%\system32\inetsrv\appcmd set config /section:directoryBrowse /enabled:true – Mickey Perlstein Aug 16 '12 at 09:48
- 
                    7I 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. http://forums.iis.net/post/1993018.aspx – Walter Stabosz Feb 18 '14 at 16:11
- 
                    1@WalterStabosz Thanks for that comment. I got this to work, by following your comment. – abhi Apr 28 '14 at 12:56
- 
                    `ERROR ( hresult:80070020, message:Failed to commit configuration changes. The process cannot access the file because it is being used by another process.` – Junior Mayhé Aug 09 '18 at 19:47
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
 
    
    - 5,705
- 2
- 27
- 34
 
    
    - 2,371
- 2
- 29
- 58
for those coming across this years later: directory browsing can also be enabled via IIS Manager:

 
    
    - 12,279
- 5
- 36
- 59
 
    
    - 333
- 3
- 17
- 
                    Thanks. That's precisely what I needed for a project folder on my localhost. – TechnoCat Nov 19 '18 at 04:38
 
     
    