c# - 为什么 IIS 8.0 Express 在 Visual Studio 2012 中重命名后使用旧项目名称

标签 c# asp.net-mvc-4 project iis-express

在一些命名困惑之后,我的团队决定重命名一些项目和项目中所有现有代码文件的命名空间。 (在 Visual Studio 2012 中)

我们改变了:

  • 项目名称
  • 项目属性中的程序集名称、默认命名空间、标题和产品条目
  • 每个重命名的项目中每个代码文件的命名空间
  • 修改后的命名空间的所有 using 语句
  • 清除了/bin 目录中的旧 .dll 文件(以便路由引擎找不到多个 Controller )
  • 实际文件夹本身,需要删除项目并将其重新添加到解决方案(并重新引用已重命名的项目)

在这一切之后,IIS 8.0 Express 仍然坚持使用旧的项目名称作为站点名称(在本地调试时)。我该如何解决这个问题?

编辑: 真正的问题是:IIS 8.0 Express 如何确定站点名称

这是网站的(其中一个).csproj 文件的片段

<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>

...没有任何网站名称。

最佳答案

问题根本不在项目中。

在 applicationhost.config 文件中 (iis.net link) , 通常在

(用户目录)\My Documents\IISExpress\config\applicationhost.config

有一个站点的设置。只需更改站点的名称属性即可。

       <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>

关于c# - 为什么 IIS 8.0 Express 在 Visual Studio 2012 中重命名后使用旧项目名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12359995/

相关文章:

c# - 在 C# 中,如何从一个内存程序集中引用另一个内存程序集中的类型?

c# - 需要帮助解决我在使用 Linq-to-Objects 查询时遇到的性能问题吗?

c# - Silverlight 和异步调用的问题

web-services - 修复 SoapUI 中的 "Missing SOAP Operations in Project"错误

c# - SelectPdf HtmlToImage 抛出 "Conversion error: Unknown error"

asp.net-mvc - 多个字段的远程验证

.net - 如何将字符串连接到 MVC4 中模型返回的数据

asp.net-mvc - 使用 "RedirectToAction"从 Controller 重定向到哈希值

Python:为文件夹中的所有文件设置元类

android-studio - 如何修复 Android Studio 中的灰色导入模块?