问题
After some naming confusing my team decided to rename some projects and the namespaces for all the existing code files in the project. (In Visual Studio 2012)
We've changed:
- the Project Names
- the Assembly Name, Default namespace, Title and Product entries in the Project Properties
- the namespaces for each code file in each project that was renamed
- all the using statements for the revised namespaces
- cleared out the old .dll files in the /bin directory (for the routing engine to not find multiple controllers)
- the actual folders themselves, requiring removing and re-adding the projects to the solution (and re-doing references to the projects that were renamed)
After all of this, IIS 8.0 Express still insists on using the old project names for the site names (while locally debugging). How can I fix this?
Edit: The real question is this: How does IIS 8.0 Express determine the site name?
Here's a snipped from (one of) the .csproj files for a website
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<UseIIS>True</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>52143</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:53177/</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>
</CustomServerUrl>
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
...and nothing for site name.
回答1:
The problem isn't in the Project at all.
In the applicationhost.config file (iis.net link), typically in
(user-dir)\My Documents\IISExpress\config\applicationhost.config
There are settings for the a site. Simply change the name attribute of the site.
<site name="MvcApplication1" id="3">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="(whateverpath)\My Documents\Visual Studio 2012\Projects\MvcApplication1\MvcApplication1" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:57733:localhost" />
</bindings>
</site>
回答2:
You will have to find and change these names in csproj files and sln files as well (which are basically xml files with file extensions that VS uses).
First and most importantly, back up all your stuff, just in case. Next, do a text search for the old names (hopefully they weren't called something like "if") within the csproj/sln files. Change the names, and then try launching.
I'm not aware of a tool or an automated way of doing this, but I have successfully done this by hand as described above.
回答3:
Did you reconfigure IIS Express? On the project propertis, on the web tab, click "Create Virtual Directory"
来源:https://stackoverflow.com/questions/12359995/why-is-iis-8-0-express-using-the-old-project-names-after-rename-in-visual-studio