English 中文(简体)
Add a *new* DestinationBinding for a site to a package using MSDeploy
原标题:

I m using a staging model with MSDeploy to deploy a couple of our sites to a web farm. The sites are configured in IIS on the staging boxes only, and then MSDeploy is used to build the target web servers from scratch.

The staging box uses its own bindings (ie no header entries, different IPs/ports and no host headers) for the sites that will be live. When I deploy them I first have an xml file used to prepare a parameterised package (using the -declareParamFile switch) which declares parameters as follows:

<parameters>
  <parameter name="site1">
    <parameterEntry kind="DestinationBinding" scope="Site1" match=":17000:" />
  </parameter>
</parameters>

So in the above XML you can see that the staged site is hosted on port 17000 as the match attribute is set to match a binding that has that value.

When I then deploy to each live site, I use a different parameters XML that specifies the correct host header and IP for that machine - I apply this using the -setParamFile switch. Here s an example of one of them.

<parameters>
  <setParameter name="site1" value="[ip_addr]:[port]:[host_header]"/>
</parameters>

So, because the original parameter is declared to match one of the known bindings - I can replace that binding with what I actually want it to be on each live server.

What I want to do now is to deploy the site and add new destination bindings to it that incorporate the different TLDs that we have - i.e. site.com, site.co.uk, site.ca etc, all bound on the same IP address and port.

The reasons for wanting to do this are:

  • We have a new site that we want to deploy that will need a different hostname, but we don t want to give it it s own IP address (running out of IPs here!) but have it share the IP that an existing site on the servers already has.
  • This means adding specific hostname bindings to the site that s already on there, instead of having it respond to any hostname.
  • We have four domain names currently pointing to the existing site s load balanced IP(.com, .us, .ca, .com.au). At the moment it works because the web server doesn t care about the host header - but when the new site goes on the same IP, it will, and the other domain names will no longer work.

The problem is I don t think there appears to be any way of adding such information. I ve tried adding multiple setParameter elements in the second XML, but that simply has the effect of repeatedly overwriting the binding, with the last one as the eventual winner.

One solution is for me to add placeholder bindings for each of the sites on the staging box, which represent the target external bindings for each domain name, port etc; and then I modify the two parameters files to replace those bindings with the real ones.

But to me this feels completely wrong - that would be modelling the staging box to suit the live deployment; it should be the other way around.

Is it possible to actually add site bindings with MSDeploy (if so, how?), or does it only support replacement?

最佳回答

After much head-banging, it appears that there is no way to add new bindings using the DestinationBinding operation with msdeploy.

What would be possible would be to attach a script to be executed after deployment that adds the bindings using appcmd every time.

So, the initial synchronisation via msdeploy would remove those bindings (because they re not on the staging server) but the appcmd script would then add them again.

Not really an ideal solution, though, as it s yet another script that has to be kept up to date.

问题回答

暂无回答




相关问题
Session Management with Windows Authentication

In an ASP.NET web app, using Integrated Windows Authentication, is the session tied to the windows identity? In other words, if I login (using IWA) to the app, and the app stores some "stuff" in my ...

Using Elmah with Cassini

Does anyone know if I can use Elmah with Visual Studio build-in web server(aka Cassini)? I get it working easily on IIS, but using same configuration, it doesn t work with Cassini. When I requested ...

Setting hostname in IIS, include www?

I want to set the hostname for a website I m adding in IIS 7, however do I include the www in the hostname or not? because I want both www.mysite.com and mysite.com both to point to mysite on the ...

inetpub versus any other folder

I ve run websites out of inetpub, as well as from folders just residing on the C: drive. I wonder, are there any definitive advantages to running websites out of inetputwwwroot?

IIS 6.0 hangs when serving a web-service

I am having issues with one of our web-services. It works fine on my development machine (win XP) whether I host it as a separate application or using cassini from Visual studio. Once I deploy on the ...

热门标签