小编Ana*_*tel的帖子

WCF .NET Core-WsHttpBinding配置project.json

如何使用.NET Core配置wsHttpBinding,是否应在Project.json文件中进行配置?在.NET Core之前的配置如下

<system.serviceModel>
<bindings>
  <wsHttpBinding>
    <binding name="IService_Endpoint">
      <security mode="None" />
    </binding>
  </wsHttpBinding>
</bindings>
<client>
  <endpoint address="http://serviceURL/Service.svc"
      binding="wsHttpBinding" bindingConfiguration="IService_Endpoint"
      contract="IService" name="IService_Endpoint" />
</client>
Run Code Online (Sandbox Code Playgroud)

我发现有一篇看起来不错的文章,但它的BasicHttpBinding需要wsHttpBinding。

ChannelFactory<IGetPeopleService> factory = null;  
IGetPeopleService serviceProxy = null;  
Binding binding = null;

binding = new BasicHttpBinding(BasicHttpSecurityMode.None);  
factory = new ChannelFactory<IGetPeopleService>(binding, new EndpointAddress("http://localhost/people.svc"));  
serviceProxy = factory.CreateChannel();

var result = serviceProxy.GetPeopleData(100);
Run Code Online (Sandbox Code Playgroud)

wcf asp.net-core-1.0

5
推荐指数
1
解决办法
5481
查看次数

标签 统计

asp.net-core-1.0 ×1

wcf ×1