【发布时间】:2012-08-12 22:09:09
【问题描述】:
我在客户端有一个 wcf 配置。我需要在 AppSettings 中使用 ServerIP 的键来命名 App.Config 中的其他部分,而不是 localhost,因为我的端点数量很多而且我的服务器 ip 是可变的。我该怎么办?
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="ServerIP" value="localhost"/>
</appSettings>
<system.serviceModel>
<bindings>
...
</bindings>
<client>
<endpoint address="net.tcp://localhost:9000/WcfServices/Person/PersonService"
binding="netTcpBinding" bindingConfiguration="RCISPNetTcpBindingWpf"
contract="Common.ServiceContract.IPersonService" name="BasicHttpBinding_IPersonService">
<identity>
<dns value="localhost" /> <!--How use ServerIP in appSettings instead of localhost-->
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>
【问题讨论】:
标签: c# configuration app-config appsettings