我有一个使用 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" />
尝试运行设置时,我收到一条错误消息,提示“找不到节点://configuration/system.ServiceModel/services/service/host/baseAddresses//在 XML 文件中添加”
显然节点的路径是错误的,但我看不到怎么做,谁能帮助我?