Hello John,
Here's the code I use (assuming that you used the script that
populates site number into combobox value field). I actually install
up to 2 virtual directories on one or two sites per setup (CLIENT and
ADMIN below). The series of properties is set as a result of these
actions. See below on how I use properties.
ia - internet address, ip - internet port, hn - host name.
-------------------------------------------------------------
Option Explicit
Const ERROR_SUCCESS = 0
Const ERROR_INSTALL_FAILURE = 1603
Const ERROR_FUNCTION_FAILED = 1627
Function ParseClient()
ParseClient = ParseSite("CLIENT")
End Function
Function ParseAdmin()
ParseAdmin = ParseSite("ADMIN")
End Function
Function ParseSite(prefix)
Dim objIIS
Dim sSite, sBinding, sURL
Dim aBinding
Dim one, two, ia, ip, hn
sSite = Session.Property(prefix & "SITE")
Set objIIS = GetObject("IIS://localhost/W3SVC/" & sSite)
If Err.Number <> 0 Then
ParseSite = ERROR_INSTALL_FAILURE
Exit Function
End If
aBinding = objIIS.ServerBindings
If IsArray(aBinding) Then
sBinding = aBinding(0)
Else
sBinding = aBinding
End If
Set objIIS = Nothing
one = Instr(sBinding, ":")
two = Instr((one + 1), sBinding, ":")
ia = Mid(sBinding, 1, (one - 1))
ip = Mid(sBinding, (one + 1), ((two - one) - 1))
hn = Mid(sBinding, (two + 1))
If ia = "" Then
ia = "*"
End If
Session.Property(prefix & "IA") = ia
Session.Property(prefix & "IP") = ip
Session.Property(prefix & "HN") = hn
ParseSite = ERROR_SUCCESS
End Function
----------------------------------------------------------------
Using properties:
<WebSite Id="WEB_ADMIN01" Description="Default Admin Site">
<WebAddress Id="WEV_ADMIN04" Port="[ADMINIP]" IP="[ADMINIA]" />
</WebSite>
<WebSite Id="WEB_CLIENT01" Description="Default Client Site">
<WebAddress Id="WEV_CLIENT04" Port="[CLIENTIP]" IP="[CLIENTIA]" />
</WebSite>
and
<WebVirtualDir Id="WEB_ADMIN03" Alias="[ADMINDIR]" Directory="MYDIR"
WebSite="WEB_ADMIN01" DirProperties="WEB_DIRPROPS">
<WebApplication Id="WEB_ADMIN02" Name="[ADMINDIR]" AllowSessions="yes"
DefaultScript="VBScript" SessionTimeout="20" />
</WebVirtualDir>
Thus the proper port and IP are substituted based on selection.
I schedule the custom action(s) as immediate on Next push button click
in UI.
You can also try using ("http://" & hn) to set some property and then
use it in Header attribute of WebAddress to differentiate site 2 in
your example.
Hope this helps.
Wednesday, July 12, 2006, 8:00:10 AM, you wrote:
> -All-
>
> First I would like to thank everyone for the great help and support I
> got through this mailing list. The help was great and I got the combo
> box populating with the sites. Now I have a different problem related
> to websites.
>
> Let's say I have three sites on my box. The default site running on
> port 80 with no host header, site 1 running on port 81 with no host
> header and finally site 2 running on port 80 with a host header value of
> SITE2.
>
> When I select a site from my combo box and set the values Website
> element it appears that it is always installing under the default site.
> How do I handle this properly. More importantly, how do I handle this
> in a generic way so that no knowledge of the destination machine is
> required to do the install.
--
Best regards,
Alexei Boukirev
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
WiX-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wix-users