简体   繁体   English

如何以编程方式在WCF中编写端点配置C#

[英]how to write endpoint configuration in wcf Programmatically c#

I m trying to create end point configuration Programmatically, below is the config file generated, I want to create same configuration using c# programmatically.I want to set bindingConfiguration,contract,name,binding,address through programatically. 我正在尝试以编程方式创建端点配置,下面是生成的配置文件,我想以编程方式使用c#创建相同的配置。我想以编程方式设置bindingConfiguration,contract,name,binding,address。

 <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_IFakeService" />
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost:55536/FakeService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IFakeService" contract="ChannelAdam.Wcf.BehaviourSpecs.TestDoubles.IFakeService" name="BasicHttpBinding_IFakeService" />
    </client>
  </system.serviceModel>
var binding = new BasicHttpBinding() {
    Name = "BasicHttpBinding_IFakeService",
    MaxBufferSize = 2147483647,
    MaxReceivedMessageSize = 2147483647
};

var endpoint = new EndpointAddress("http://localhost:55536/FakeService.svc");
MyInterfaceClient client = new MyInterfaceClient(binding, endpoint);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM