How to rename an IIS Express website in Visual Studio 2012
Asked Answered
I

3

19

I initially created a site in Webmatrix 2. I just called it website1. I've now been working on the site in Visual Studio 2012 and I would like to rename it. It doesn't appear you can rename it directly, but in the .sln file there is a project entry which contains the string "website1". I renamed it and re-started VS. The new name briefly displays but then gets overwritten with the original name. So now I have the .sln file with the new name and nowhere within the folders does it reference the old name - i've searched every file. But yet VS insists on calling the site website1. So i'm totally confused.

Any ideas where VS stores the name of websites? The only thing I can come up with is how VS integrates with IIS Express. Perhaps it is taking the name from IIS instead?

Incursive answered 17/1, 2013 at 1:57 Comment(2)
possible duplicate of Why is IIS 8.0 Express using the old project names after rename in Visual Studio 2012Mandell
use C:\Program Files (x86)\IIS Express>appcmd.exe to manage the web apps e.g. appcmd.exe list vdir gyorgybalassy.wordpress.com/2013/12/02/…Elevated
R
25

I had the exact same problem, and after a lot of hair pulling realized that IIS Express (as you said) somehow was the culprit. However, I couldn't find out where the site name was stored.

This is what I ended up doing (in addition to renaming directories and replacing the old project name with the new one in the solution file):

  • Open up the .sln file
  • Locate the Project entry for the web site you want to rename
  • Change the port of the URL. This will force IIS Express to treat it as a new site.

Hope this helps someone!

Reno answered 24/4, 2013 at 8:51 Comment(3)
Using some of your information, I found that IISExpress had an "applicationhost.config" file located in my %UserProfile%\Documents\IISExpress\config directory. Opening that file showed all the sites. In my case it already had the name of the site in it that I wanted in my solution, so the solution kept adding a (1) to the end of the website. Changed the name in there and removed the dup, restarted the solution and it worked fine.Loreleilorelie
Thanks god i found the solution here, i just experience this problem. VS2013 keep add 1 to my website name.Fated
Yea, thanks for this. The comment above about the %USERPROFILE%\Documents\IISExpress\config\applicationhost.config was the lead I needed.Capsulize
F
32

I just encounter the same problem with you during using VS 2013, it turned out that it's caused by IIS Express, finally I solved it by following steps:

  1. Find the applicationhost.cofig of your IIS Express, usually it should be listed in Folder C:\Users{username}\Documents\IISExpress\config
  2. Locate the corresponding site section of your project in the cofig file
  3. Remove all those site section with simillar site name like ProjectNameABC and ProjectNameABC(1)
  4. Close and Reopen your solution in vs, you'll found that the spefic name for your web project come back
Flagler answered 10/2, 2014 at 8:56 Comment(3)
This Solution Work for me ! (y)Supersede
Instead of closing and reopening the solution I had to click Create Virtual Directory button under the project properties/Web in VS.Rayraya
Can someone tell me how do you do it in visual studio 2019?Quintin
R
25

I had the exact same problem, and after a lot of hair pulling realized that IIS Express (as you said) somehow was the culprit. However, I couldn't find out where the site name was stored.

This is what I ended up doing (in addition to renaming directories and replacing the old project name with the new one in the solution file):

  • Open up the .sln file
  • Locate the Project entry for the web site you want to rename
  • Change the port of the URL. This will force IIS Express to treat it as a new site.

Hope this helps someone!

Reno answered 24/4, 2013 at 8:51 Comment(3)
Using some of your information, I found that IISExpress had an "applicationhost.config" file located in my %UserProfile%\Documents\IISExpress\config directory. Opening that file showed all the sites. In my case it already had the name of the site in it that I wanted in my solution, so the solution kept adding a (1) to the end of the website. Changed the name in there and removed the dup, restarted the solution and it worked fine.Loreleilorelie
Thanks god i found the solution here, i just experience this problem. VS2013 keep add 1 to my website name.Fated
Yea, thanks for this. The comment above about the %USERPROFILE%\Documents\IISExpress\config\applicationhost.config was the lead I needed.Capsulize
O
4

I had the same problem for HTTPS and Visual Studio 2015.

The IIS Express configuration file "C:\Users{username}\Documents\IISExpress\config\applicationhost.config" didn´t have the reference for my site.

I found the reference inside the solution directory in a hide directory

"{Solution}\.vs\config\applicationhost.config"

I removed the entry for the old copy site, closed and reopen the project and everything was right.

Oceania answered 1/2, 2017 at 9:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.