简体   繁体   中英

Visual Studio 2013, IIS, IIS Express - bug?

An ASP.NET C# project would't load with error:

The site for the URL ' http://localhost:51752/ ', configured for Web project 'AndroidWS', exists on both the local IIS web server and the IIS Express web server. You need to use IIS Manager to change this site's binding(s) in IIS.

If I delete

<site name="AndroidWS" id="1"> ... </site>

section from IIS Express configuration file, I get another kind of error:

The URL ' http://localhost:51752/ ' for Web project 'AndroidWS' is configured to use IIS Express as the web server but the URL is currently configured on the local IIS web server. To open this project, you must use IIS Manager to remove the bindings using this URL from the local IIS web server.

But this project is not configured to use IIS Express:

<UseIISExpress>false</UseIISExpress>
<UseIIS>false</UseIIS>

The only way to open this project is to set:

<UseIIS>true</UseIIS>

Ok, it is a workaround, but I am not very comfortable with it because of our team work process - I have to set this parameter back to false before every check-in.

PS. This situation repeats for all projects - Visual Studio says that they are configured to use IIS Express, but they are not.

Deleting the csproj.user did the trick. The message

"xxx is configured to use IIS Express as the web server but the URL is currently configured on the local IIS web server. To open this project, you must use IIS Manager to remove the bindings using this URL from the local IIS web server."

is misleading as the conflicting info is not in IIS but in the csproj.user file.

  1. When you create WebApplication type of project in Visual Studio you have three option for servers ie UseIISExpress, UseIIS and ExternalHost. (If IIS is not installed then 2 options only ie IIexprss and External Host)
  2. So essentially you must choose one option out of these 3 options. Default is IISExpress. You can not set ALL server options to false in project file. Even if you do that Visual Studio assums default option ie IISExpress is enabled.
  3. If you need to use local IIS while rest of team uses IISExpress then you can select "Local IIS" option from servers dropdown and unlcheck checkbox "Apply server settings to all users" which is located just above servers dropdown. This will save configuration settings in .csproj.user file which you dont need to check in into source control. This way you will use local IIS while team will continue using IIS Express.

从IIS管理器中删除了所有站点,“默认网站”除外,现在一切正常。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM