[IIS] Clean up IIS Express configuration

I tend to create a lot of test web sites and applications in Visual Studio for learning purposes. Now I have ended up hosting many unused sites in IIS Express. Let’s clean up them.

 

1. Where is the configuration?

Unlike IIS, IIS Express does not have UI to view and configure sites and settings. You can directly access the configuration file.
C:\Users\{userName}\Documents\IISExpress\config\applicationhost.config

You can find the <sites> section in the file. But it is not recommended to modify the file directly.

 

2.  appcmd.exe

Fortunately, you can use the command line tool “appcmd.exe“.

It is located in the “C:\Program Files (x86)\IIS Express” folder.

 

3. Viewing the List of Sites

You can see the list of sites:

> appcmd list site

Or you can see the virtual directories

> appcmd list vdir

 

4. Renaming the Site

One way to clean up the site is to rename it.

> appcmd set site WebSite(1) -name:MySite

 

5. Delete the Site

You can remove the unused site completely.

> appcmd delete site WebSite(1)

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s