如何在Wix中找到baseAddress?

时间:2012-12-17 10:09:22

标签: xml wcf wix install base-address

我有一个使用Wix进行设置的Wcfservice。

在安装过程中,我有一个收集不同设置的Gui,然后在Product.wxs中更改这些设置。但是我很难找到我想要更改的baseAddress设置。

我的配置文件包含以下部分:

<system.serviceModel>
    <behaviors>
        <serviceBehaviors>
            <behavior name="Default">
                <serviceMetadata httpGetEnabled="true"/>
            </behavior>
        </serviceBehaviors>
    </behaviors>
    <services>
        <service behaviorConfiguration="Default" name="OurServiceLibrary.OurService">
            <clear/>
                        <endpoint name="OurBasicHttpBinding" address="basic" binding="basicHttpBinding" contract="OurServiceLibrary.IOurService" listenUriMode="Explicit"/>
            <host>
                <baseAddresses>
                    <!-- The base-address must be updated with the correct url for the hosting machine. -->
                    <add baseAddress="http://localhost:8081/ourservice"/>
                </baseAddresses>
            </host>
        </service>
    </services>
</system.serviceModel>

我尝试更改设置时使用的代码是:

<!--Put path to settings in local variable-->
<?define ServiceModelSettingsPath="//configuration/system.ServiceModel/services/service/host/baseAddresses/" ?>

<!--Modify settings with values entered in the installation UI-->
<util:XmlFile Id="ModifyServiceBaseAdress"
         Action="setValue"
         Permanent="yes"
         ElementPath="$(var.ServiceModelSettingsPath)/add"
         Name ="baseAddress"
         File="[#OurServiceSettingsFile]"
         Value="connectionString=[SERVICEBASEADRESS_VALUE]"
         SelectionLanguage="XPath"
         Sequence="1" />

尝试运行安装程序时,我收到错误消息“无法在XML文件中找到node://configuration/system.ServiceModel/services/service/host/baseAddresses//add”

显然,节点的路径是错误的,但我看不出有人能帮助我吗?

1 个答案:

答案 0 :(得分:0)

就是这样,一个简单的拼写错误。双斜线没有任何区别。但是在路径中更改为serviceModel。

然后我发现了另一个错误,我在设置值时不需要connectionString =,只有:

值= “[EVENTREPORTINGADDRESS_VALUE]”

谢谢!