2
votes

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?

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 /
1
Same issue - did you get to the bottom of this? - Paul George

1 Answers

0
votes

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.

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.

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