当我打开解决方案时,我的解决方案文件中有一个“不可用”的web项目。当我右键单击web项目并重新加载项目时,我得到以下错误:

Web应用程序项目mycompany.myapp.mywebproject已配置为使用IIS。无法找到Web服务器http://localhost/MyWebApp。

我还没有为这个web应用程序手动设置虚拟目录。

每个同事,Visual Studio应该提示我创建虚拟目录,但我没有得到提示。

在我的开发机器上安装IIS之前,我安装了VS2010。

这是我的开发机器设置:

Windows 7企业版 服务包1 64位操作系统 Visual Studio 2010企业服务包 IIS 7.5版


当前回答

您可以在不将属性UseIIS的值设置为true的情况下加载项目。 只需遵循以下步骤:

在mywebproject中。csproj文件——

删除标签< IISUrl>http://localhost/MyWebApp/< /IISUrl>并保存文件。 应用程序将自动为其分配默认端口。

其他回答

编辑.csproj或vbproj文件。找到并替换这些条目

<UseIIS>true</UseIIS> by <UseIIS>false</UseIIS>
<UseIISExpress>true</UseIISExpress> by <UseIISExpress>false</UseIISExpress>

在我的情况下,确保你有一个“默认”网站

如果您是通过TFS连接的,请打开project. csproject .user文件并检查是否存在

<UseIISExpress>false</UseIISExpress>

把它改成真。

<UseIISExpress>true</UseIISExpress>

原来我的IIS在localhost:8181上工作。必须配置{Project}。csproj文件。

    <ProjectExtensions>
    <VisualStudio>
      <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
        <WebProjectProperties>
          <UseIIS>True</UseIIS>
          <AutoAssignPort>True</AutoAssignPort>
          <DevelopmentServerPort>7386</DevelopmentServerPort>
          <DevelopmentServerVPath>/</DevelopmentServerVPath>
          <IISUrl>**http://localhost:8181/ProjectName**</IISUrl>
          <NTLMAuthentication>False</NTLMAuthentication>
          <UseCustomServer>False</UseCustomServer>
          <CustomServerUrl>
          </CustomServerUrl>
          <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile><EnableWcfTestClientForSVCDefaultValue>True</EnableWcfTestClientForSVCDefaultValue>
        </WebProjectProperties>
      </FlavorProperties>
    </VisualStudio>
  </ProjectExtensions>

当。csproj文件中的<ProjectTypeGuids>元素包含单元测试项目GUID: {3ac096d0 - acc2 - e12c -1390- a8335801fdab}时,我遇到了这个问题。

删除它使项目加载没有问题。