Asp.net

為什麼我的網站項目名稱的括號中有一個數字?

  • January 21, 2016

這只是一個好奇/煩惱,而不是真正的問題。

我有一個使用 VS 2013 的 Web 表單網站項目。不知何故,項目名稱中包含**(1)(2),我嘗試編輯解決方案文件,刪除所有其他站點,重建/清理等,仍然無法弄清楚它從哪裡得到(2)**。

在此處輸入圖像描述

解決方案文件:

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Express 2013 for Web
VisualStudioVersion = 12.0.30501.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "Site", "http://localhost:52806", "{5411FD57-5AFE-4A3A-9474-0DCD64C89003}"
   ProjectSection(WebsiteProperties) = preProject
       UseIISExpress = "true"
       TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.0"
       Debug.AspNetCompiler.VirtualPath = "/localhost_52806"
       Debug.AspNetCompiler.PhysicalPath = "..\..\..\..\..\..\Dropbox\Projects\Site\"
       Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_52806\"
       Debug.AspNetCompiler.Updateable = "true"
       Debug.AspNetCompiler.ForceOverwrite = "true"
       Debug.AspNetCompiler.FixedNames = "false"
       Debug.AspNetCompiler.Debug = "True"
       Release.AspNetCompiler.VirtualPath = "/localhost_52806"
       Release.AspNetCompiler.PhysicalPath = "..\..\..\..\..\..\Dropbox\Projects\Site\"
       Release.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_52806\"
       Release.AspNetCompiler.Updateable = "true"
       Release.AspNetCompiler.ForceOverwrite = "true"
       Release.AspNetCompiler.FixedNames = "false"
       Release.AspNetCompiler.Debug = "False"
       SlnRelativePath = "..\..\..\..\..\..\Dropbox\Projects\Site\"
   EndProjectSection
EndProject
Global
   GlobalSection(SolutionConfigurationPlatforms) = preSolution
       Debug|Any CPU = Debug|Any CPU
   EndGlobalSection
   GlobalSection(ProjectConfigurationPlatforms) = postSolution
       {5411FD57-5AFE-4A3A-9474-0DCD64C89003}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
       {5411FD57-5AFE-4A3A-9474-0DCD64C89003}.Debug|Any CPU.Build.0 = Debug|Any CPU
   EndGlobalSection
   GlobalSection(SolutionProperties) = preSolution
       HideSolutionNode = FALSE
   EndGlobalSection
EndGlobal

您可能有兩個具有相同 IIS 綁定資訊的站點。如果我創建、刪除然後重新創建一個網站,這通常會發生在我身上。

找到您的 IISExpress 文件夾(我的文件夾在 C:\Users\brandon\Documents\IISExpress 中),然後轉到 config/applicationhost.config

使用重複綁定找到您的站點名稱並刪除該<site>節點。它看起來像這樣

<site name="WEBSITENAME" id="21">
   <application path="/" applicationPool="Clr2IntegratedAppPool">
       <virtualDirectory path="/" physicalPath="C:\Users\...\YourProject" />
   </application>
   <bindings>
       <binding protocol="http" bindingInformation="*:SomePortNumber:localhost" />
   </bindings>
</site>

我正在使用 Visual Studio 2015,我只是刪除了.vs解決方案根目錄中的文件夾。它包含.vs\config\applicationhost.config.vs\mySolutionName\v14\.suo

編輯其中一個文件,可能刪除舊的 IIS Express 綁定或其他東西,可能是這樣做的好方法。但是破解 .vs-folder 並重新載入解決方案對我有用。

引用自:https://stackoverflow.com/questions/24048745