为不同的环境配置WCF

时间:2017-02-17 14:56:32

标签: vb.net visual-studio wcf

桌面应用程序中用于配置WCF服务以进行连接的最佳做法是根据您在开发环境,系统测试环境,生产等方面做不同的端点?当我进行连接到DB的Web应用程序开发时,我修改了web.config以基于vertical具有不同的连接字符串。它与WCF端点的方法相同,只是更新app.config文件吗?

谢谢!

1 个答案:

答案 0 :(得分:0)

使用配置文件转换:https://msdn.microsoft.com/en-us/library/dd465318(v=vs.100).aspx

例如:

<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
   <system.serviceModel>
      <client>
         <endpoint name="BasicHttpBinding_IService" address="NEW_ADDRESS"
           xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
      </client>
   </system.serviceModel>
</configuration>