简体   繁体   English

Visual Studio 2013,IIS,IIS Express-错误?

[英]Visual Studio 2013, IIS, IIS Express - bug?

An ASP.NET C# project would't load with error: ASP.NET C#项目不会加载并显示错误:

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. 为Web项目'AndroidWS'配置的URL'http :// localhost:51752 / '的站点在本地IIS Web服务器和IIS Express Web服务器上均存在。 You need to use IIS Manager to change this site's binding(s) in IIS. 您需要使用IIS管理器来更改IIS中此站点的绑定。

If I delete 如果我删除

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

section from IIS Express configuration file, I get another kind of error: 在IIS Express配置文件中,出现另一种错误:

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. Web项目'AndroidWS'的URL'http :// localhost: 51752 /'已配置为使用IIS Express作为Web服务器,但是当前在本地IIS Web服务器上配置了URL。 To open this project, you must use IIS Manager to remove the bindings using this URL from the local IIS web server. 若要打开此项目,必须使用IIS管理器从本地IIS Web服务器中删除使用此URL的绑定。

But this project is not configured to use IIS Express: 但是此项目未配置为使用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. 好的,这是一种解决方法,但是由于我们的团队工作流程,我对此不太满意-我必须在每次入住之前将此参数设置回false。

PS. PS。 This situation repeats for all projects - Visual Studio says that they are configured to use IIS Express, but they are not. 所有项目都重复这种情况-Visual Studio表示将它们配置为使用IIS Express,但事实并非如此。

Deleting the csproj.user did the trick. 删除csproj.user就可以了。 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." “ xxx被配置为使用IIS Express作为Web服务器,但当前在本地IIS Web服务器上配置了URL。要打开此项目,必须使用IIS管理器从本地IIS Web服务器上使用此URL删除绑定。”

is misleading as the conflicting info is not in IIS but in the csproj.user file. 之所以会产生误导,是因为冲突的信息不在IIS中,而在csproj.user文件中。

  1. When you create WebApplication type of project in Visual Studio you have three option for servers ie UseIISExpress, UseIIS and ExternalHost. 在Visual Studio中创建WebApplication类型的项目时,对于服务器,有三个选项,即UseIISExpress,UseIIS和ExternalHost。 (If IIS is not installed then 2 options only ie IIexprss and External Host) (如果未安装IIS,则只有2个选项,即IIexprss和External Host)
  2. So essentially you must choose one option out of these 3 options. 因此,基本上,您必须从这三个选项中选择一个选项。 Default is IISExpress. 默认值为IISExpress。 You can not set ALL server options to false in project file. 您不能在项目文件中将所有服务器选项设置为false。 Even if you do that Visual Studio assums default option ie IISExpress is enabled. 即使您执行该操作,Visual Studio也会假定默认选项即IISExpress已启用。
  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. 如果您需要在团队其他成员使用IISExpress时使用本地IIS,则可以从服务器下拉列表中选择“本地IIS”选项,然后取消选中位于服务器下拉列表上方的“将服务器设置应用于所有用户”复选框。 This will save configuration settings in .csproj.user file which you dont need to check in into source control. 这会将配置设置保存在.csproj.user文件中,您无需将其检入源代码管理。 This way you will use local IIS while team will continue using IIS Express. 这样,您将使用本地IIS,而团队将继续使用IIS Express。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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