我在客户端有一个wcf配置。我需要在AppSettings中使用密钥ServerIP
App.Config中的其他部分的名称而不是localhost
,因为我的端点数很多,而且我的服务器ip是可变的。我怎么能呢?如何使用app.config本身的AppSettings
<?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>