如何指定IIS网站以通过visual studio创建部署包 [英] How do I specify an IIS website to create a deployment package via visual studio

查看:196
本文介绍了如何指定IIS网站以通过visual studio创建部署包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过Visual Studio 2010为我的网站创建一个部署包。有问题的网站有一个绑定,我指向我的hosts文件中的127.0.0.1。我的Web应用程序项目设置指向该网站,一切正常。但是,当我尝试创建包时,会使用来自错误站点的设置。如何告诉部署包使用正确的设置以及控制此操作的机制?

I am attempting to create a deployment package for my website via Visual Studio 2010. The website in question has a binding that I point to 127.0.0.1 in my hosts file. My web application project settings point to that website and all works fine. When I try to create a package, however, the settings from the wrong site are used. How can I tell the deployment package to use the correct settings and what mechanism controls this?

更新:
看来, Microsoft.Web.Publishing.targets中的MapUriToIisWebServer任务将出现错误的IIS网站。通过命令行使用msbuild的输出得到了:

Update: It appears that the MapUriToIisWebServer task in Microsoft.Web.Publishing.targets is coming up with the wrong IIS website. Got that from the output of using msbuild via the command line:

Package:
  Invoking Web Deploy to generate the package with the following settings:
  $(LocalIisVersion) is 7
  $(DestinationIisVersion) is 7
  $(UseIis) is True
  $(IisUrl) is http://mysite <-- correct url (use hosts file to point localhost)
  $(IncludeIisSettings) is true
  $(_DeploymentUseIis) is True
  $(DestinationUseIis) is True
  $(IisUrl_SiteID) is 2 <-- not the correct id
  $(IisUrl_SiteFriendlyName) is notmysite.com <-- not the correct url
  $(IisUrl_SiteRelativePath) is /


推荐答案

MapUriToIisWebServer任务最终会调用 Microsoft.Web.Publishing.Tasks.Iis7WebServer
获取所提供网址的正确网站信息。 初始化(UriWrapper uri,bool useLocalHost)调用似乎做了工作,并且以某种方式出错了。

The MapUriToIisWebServer task appears to ultimately call upon Microsoft.Web.Publishing.Tasks.Iis7WebServer to get the correct site info for the supplied url. The Initialize(UriWrapper uri, bool useLocalHost) call seems to do the work, and is going wrong somehow.

我发现这个站点解析问题受IIS站点设置的影响 - 特别是主机名和IP地址。例如,如果我转到错误识别的站点并将主机名更改为其他任何内容或将ip address设置从all unassigned更改为已定义的IP地址,则站点解析将更改为另一个(也被错误识别) )IIS中的站点。再次重复此过程,然后通过构建部署包过程识别正确的站点。

I found that this "site resolution" issue is influenced by the IIS site settings - particularly hostname and the "ip addresses". For example if I go to the site that is being incorrectly identified and change either the hostname to anything else OR change the "ip address" setting from "all unassigned" to a defined ip address, then the site resolution changes to another (also misidentified) site in IIS. Repeating this process again then resulted in the correct site being identified by the "build deployment package" process.

简而言之,Microsoft.Web.Publishing.Tasks.Iis7WebServer

In short, there seems to be a bug in Microsoft.Web.Publishing.Tasks.Iis7WebServer

这篇关于如何指定IIS网站以通过visual studio创建部署包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆