2
如何使用.NET核心配置wsHttpBinding,我應該在Project.json文件中進行配置嗎? .NET的核心之前,配置是像下面WCF .NET核心 - WsHttpBinding配置project.json
<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>
我發現它的工作原理的文章看起來像我期待的,但它的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);
Tim,感謝您的回覆。我無法在同一個SystemModel程序集中解析WsHtppBinding –
@AnandPatel - 你是指'WsHttpBinding'還是'WsHtppBinding'?它應該是'WsHttpBinding'按照我的例子(兩個「t」,而不是兩個「p」)。 – Tim
對不起。是WsHttpBinding –