如何以编程方式设置WCF端点标识配置?

时间:2011-06-16 18:36:37

标签: wcf c#-4.0

如何以编程方式设置dns,如下所示进行其他配置?

  <endpoint address="https://admin.icafems.com/Services/EasyStartTrackingService.svc"
      binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IEasyStartTrackingService"
      contract="ES_Service.IEasyStartTrackingService" name="WSHttpBinding_IEasyStartTrackingService">
    <identity>
      <dns value="admin.icafems.com" />
    </identity>
  </endpoint>

    ServiceClient.Endpoint.Address = new EndpointAddress(ServiceURL);            
    ServiceClient.Endpoint.Binding = binding;
    ServiceClient.Endpoint.Name = "BasicHttpBinding_ILearningSuiteService";  

1 个答案:

答案 0 :(得分:12)

将EndpointIdentity传递给EndpointAddress的构造函数

http://msdn.microsoft.com/en-us/library/bb628618.aspx