Hello Alexei and All,

I'm new to Wix. I'm trying to make a installer for website - something
similar to what visual studio IDE provides.

I've tried using the two scripts mentioned in the posts here to populate the
combo box with the websites available on a machine as well as set the port
of the in the <WebAddress> element using the script given here. But my
installation is failing with the error message

ConfigureIIs:  Error 0x8007000d: invalid port provided for web site: 
ConfigureIIs:  Error 0x8007000d: failed to read IIsWebSite table
Error 26002. Failed to read IIsWebSite table.   (-2147024883         )

I don't know where I'm going wrong. Please guide me as to how do i set the
website port correctly.

The following are the files i'm using

Test.wxs:

<?xml version="1.0" encoding="UTF-8"?>

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi";
     xmlns:iis="http://schemas.microsoft.com/wix/IIsExtension";
     xmlns:ui="http://schemas.microsoft.com/wix/WixUIExtension"; >
  
  <Product Id="7b523f47-ef58-4d3c-8ca1-fea6be516471" Name="My Product"
Language="1033" Version="1.0.0.0" Manufacturer="Personal Co"
UpgradeCode="0a8c10df-fe3e-4aec-8954-50b9ecdb0a41">
    <Package InstallerVersion="100" Compressed="yes" />

    <Icon Id="icon.ico" SourceFile="tray.ico"/>
    <Property Id="ProductIcon" Value="icon.ico" />    
    
    <Condition Message="Only an Administrator can install this application">
      Privileged
    </Condition>

    <Condition Message="Windows Server 2003 is required">
      VersionNT = 502
    </Condition>

    <PropertyRef Id="NETFRAMEWORK20"/>
    <Condition Message="The .NET Framework 2.0 or higher must be installed">
      Installed OR NETFRAMEWORK20
    </Condition>

    <PropertyRef Id="IISMAJORVERSION"/>
    <Condition Message="IIS version 5 or higher must be installed">
      Installed OR (IISMAJORVERSION >= "#5")
    </Condition>
    
    <Media Id="1" Cabinet="WebAppWixProject.cab" EmbedCab="yes" />
    
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFilesFolder">
        <Directory Id="PersonalCo" Name="Personal Co.">
          <Directory Id="INSTALLLOCATION" Name="TestApplication">

            <Component Id="TestComponent" DiskId="1"
Guid="80b0ee2a-a102-46ec-a456-33a23eb0588e">
                <File Id="Error.aspx" Name="Error.aspx" Source="Error.aspx"
/>
              <File Id="Login.aspx" Name="Login.aspx" Source="Login.aspx" />
              
              <iis:WebVirtualDir Id="MyWebApp" Alias="TestApplication"
Directory="INSTALLLOCATION" WebSite="DefaultWebSite">
                <iis:WebApplication Id="TestWebApplication"
Name="TestApplication" />
              </iis:WebVirtualDir>

            </Component>

          </Directory>
        </Directory>
      </Directory>
    </Directory>
    
    <iis:WebSite Id='DefaultWebSite' Description='[WebsiteCombo]'
Directory='INSTALLLOCATION'>
      <iis:WebAddress Id="AllUnassigned" Port="[WebsiteComboIP]"
IP="[WebsiteComboIA]" />
    </iis:WebSite>
    
    <Feature Id="ProductFeature" Title="registeR4Health - Provider
Application" Level="1">
      <ComponentRef Id="TestComponent" />      
    </Feature>

    <UIRef Id="WixUI_Common" />

    <UI>
      <Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
      <TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
      <TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
      <TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes"
/>

      <Property Id="WIXUI_INSTALLDIR" Value="INSTALLLOCATION" />
      <Property Id="PIDTemplate" Value="####-####-####-####" />
      <Property Id="ARPNOMODIFY" Value="1" />      

      <DialogRef Id="BrowseDlg" />
      <DialogRef Id="DiskCostDlg" />
      <DialogRef Id="ErrorDlg" />
      <DialogRef Id="FatalError" />
      <DialogRef Id="FilesInUse" />
      <DialogRef Id="MsiRMFilesInUse" />
      <DialogRef Id="PrepareDlg" />
      <DialogRef Id="ProgressDlg" />
      <DialogRef Id="ResumeDlg" />
      <DialogRef Id="UserExit" />

      <Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog"
Value="Return" Order="999">1</Publish>
      <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog"
Value="LicenseAgreementDlg">1</Publish>
      <Publish Dialog="LicenseAgreementDlg" Control="Back" Event="NewDialog"
Value="WelcomeDlg">1</Publish>
      <Publish Dialog="LicenseAgreementDlg" Control="Next" Event="DoAction"
Value="GetIISSites" Order="1">LicenseAccepted = "1"</Publish>
      <Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog"
Value="LicenseKeyDlg" Order="2">LicenseAccepted = "1"</Publish>
      
      <Publish Dialog="LicenseKeyDlg" Control="Back" Event="NewDialog"
Value="LicenseAgreementDlg">1</Publish>
      <Publish Dialog="LicenseKeyDlg" Control="Next"
Event="ValidateProductID" Value="[PIDKEY]" Order="1">1</Publish>      
      <Publish Dialog="LicenseKeyDlg" Control="Next" Event="DoAction"
Value="ConfigureIISSite" Order="2">1</Publish>
      <Publish Dialog="LicenseKeyDlg" Control="Next" Event="NewDialog"
Value="InstallDirDlg" Order="3">ProductID</Publish>

      <Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog"
Value="LicenseKeyDlg">1</Publish>
      <Publish Dialog="InstallDirDlg" Control="Next" Event="SetTargetPath"
Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
      <Publish Dialog="InstallDirDlg" Control="Next" Event="NewDialog"
Value="VerifyReadyDlg" Order="2">1</Publish>
      <Publish Dialog="InstallDirDlg" Control="ChangeFolder"
Property="_BrowseProperty" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
      <Publish Dialog="InstallDirDlg" Control="ChangeFolder"
Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>
      <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog"
Value="InstallDirDlg" Order="1">NOT Installed</Publish>
      <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog"
Value="MaintenanceTypeDlg" Order="2">Installed</Publish>

      <Publish Dialog="MaintenanceWelcomeDlg" Control="Next"
Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish>
      <Publish Dialog="MaintenanceTypeDlg" Control="RepairButton"
Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
      <Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton"
Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
      <Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog"
Value="MaintenanceWelcomeDlg">1</Publish>

      <Dialog Id="LicenseKeyDlg" Width="370" Height="270"
Title="[ProductName] Setup">
        <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15"
Transparent="yes" NoPrefix="yes" Text="{\WixUI_Font_Title}User Information"
/>
        <Control Id="Description" Type="Text" X="25" Y="23" Width="280"
Height="15" Transparent="yes" NoPrefix="yes" Text="Select the website and
enter the license key to personalize your installation" />
        <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370"
Height="44" TabSkip="no" Text="!(loc.InstallDirDlgBannerBitmap)" />
        <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370"
Height="0" />

        <Control Id="WebsiteListLabel" Type="Text" X="20" Y="60" Width="290"
Height="13" Text="Available Websites:" />

        <Control Id="AvailableSitesCombo" Property="WebsiteCombo"
Type="ComboBox" X="20" Y="74" Width="320" Height="18" Text="Ppphhh"
ComboList="yes" ToolTip="The website you would like to install to">
          <ComboBox Property="WebsiteCombo"/>
        </Control>
        <Control Id="Control_Dummy" Property="CLIENTSITE" Type="ComboBox"
X="218" Y="4" Width="51" Height="17" Text="Poo" Hidden="yes" Disabled="yes">
          <ComboBox Property="CLIENTSITE">
            <ListItem Value="filler"/>
          </ComboBox>
        </Control>

        <Control Id="LicenseKeyLabel" Type="Text" X="20" Y="95" Width="290"
Height="13" Text="License Key:" />
        <Control Id="LicenseKey" Type="MaskedEdit" X="20" Y="110"
Width="320" Height="18" Property="PIDKEY" Text="[PIDTemplate]" />

        <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370"
Height="0" />
        <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56"
Height="17" Default="yes" Text="Next" />          
        <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56"
Height="17" Text="Back" />
        <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56"
Height="17" Cancel="yes" Text="Cancel">
          <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
        </Control>
      </Dialog>

    </UI>

    <CustomAction Id="GetIISSites" Execute="firstSequence" Return="check"
BinaryKey="InstallationFunctions.vbs" VBScriptCall="GetWebSites" />
    <Binary Id="InstallationFunctions.vbs"
SourceFile="InstallationFunctions.vbs"/>

    <CustomAction Id="ConfigureIISSite" Execute="firstSequence"
Return="check" BinaryKey="SetWebsiteInInstaller.vbs"
VBScriptCall="ParseWebsite" />
    <Binary Id="SetWebsiteInInstaller.vbs"
SourceFile="SetWebsiteInInstaller.vbs"/>

  </Product>
</Wix>

InstallationFunctions.vbs

' VBScript source code

Function GetWebSites( )
    Dim oThisServer, oWebsite
    Dim intI

    On Error Resume Next
    Set oThisServer = GetObject( "IIS://localhost/W3SVC" )
     
    If( Err.Number <> 0 ) Then
        MsgBox "Unable to retrive websites - " & _
            "please ensure that IIS is running" & vbCrLf & _
            "    - Error Details: " & Err.Description & " [Number:" & _
            Hex(Err.Number) & "]", vbCritical, "Error"
            GetWebSites = ERROR_INSTALL_FAILURE
        Exit Function
    Else
    intI = 0   
    For Each oWebsite In oThisServer
        If oWebsite.Class = "IIsWebServer" Then
           
            If intI = 0 Then
                '
                ' Populates property TARGETWEBCOMBO with the first Website
nr found, i.e 1 for Default Web Site
                '
                Session.Property("WebsiteCombo") = oWebsite.Name
            End If
            '
            ' Using AddToComboBox("TARGETWEBCOMBO", intI,
oWebsite.Name,oWebsite.ServerComment )
            ' wil display website name in combobox and TARGETWEBCOMBO var in
WiX will
            'contain the chosen websitenr not the string name from combobox
            '
            Call AddToComboBox( "WebsiteCombo", intI, oWebsite.Name,
oWebsite.ServerComment )
            intI = intI + 1
        End If
    Next
    '
    ' Return Success to installer logic
    '
    GetWebSites = ERROR_SUCCESS
    End If
    ' Clean up
    Set oThisServer = Nothing
    Set oWebSite = Nothing
End Function 

Sub AddToComboBox( ByVal sComboProp, ByVal iComboOrder, ByVal sComboValue,
ByVal sComboText )

    ' This function takes values passed into it from the function call and
uses these values to create
    ' and execute a oView within the current session of the Windows
Installer object.  This oView is based
    ' on a SQL query constructed using the values passed into the function.
    ' If you wish to get a deeper understanding of how this function works
you should read up
    ' on the Windows Installer object model in the Windows Installer SDK.

    ' Initialize variables
    Dim oQuery, oView

    ' SQL-query string to insert a row in ComboBox table
    oQuery = "INSERT INTO `ComboBox` " _
             & "(`Property`, `Order`, `Value`, `Text`) " & "VALUES ('" &
sComboProp _
             & "', '" & iComboOrder & "', '" & sComboValue & "', '" &
sComboText & "') TEMPORARY"
    '
    ' Creates the oView object based on our query
    '
    Set oView = Session.Database.OpenView( oQuery )
    '
    '  Invoke the query to add the combo value
    '
    oView.Execute
    ' Close open Database
    oView.Close
   
    ' Clean up
    Set oView = Nothing
End Sub

SetWebsiteInInstaller.vbs

' VBScript source code

Function ParseWebsite()
  ParseAdmin = ParseSite("WebsiteCombo")
End Function

Function ParseSite(prefix)
    
  Dim objIIS
  Dim sSite, sBinding
  Dim aBinding
  Dim one, two, ia, ip    

  sSite = Session.Property(prefix)
  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
  
  Set sSite = Nothing
  Set sBinding = Nothing
  Set aBinding = Nothing
  Set one = Nothing
  Set two = Nothing
  Set ia = Nothing
  Set ip = Nothing
  
End Function

-- 
View this message in context: 
http://www.nabble.com/WebSites-in-ComboBox-dynamically-tp5274089p18848295.html
Sent from the wix-users mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to