如果我想从我的客户端代码中删除app.config配置的必要性,并从我的c#初始化客户端。在我的C#代码中定义Bindings和EndPoint。什么是以下客户端代码的c#版本:
<client>
<endpoint address="http://employeetstsvc/Employee.svc" binding="wsHttpBinding"
bindingConfiguration="StandardEndpoint" contract="ServiceReference2.IHREmployee"
name="StandardEndpoint" />
</client>
有什么想法吗?
答案 0 :(得分:1)
如下所示。查看更多Here
String baseAddress = "http://employeetstsvc/Employee.svc";
WSHttpBinding binding1 = new WSHttpBinding();
using(ServiceHost host = new ServiceHost(typeof(Employee)))
{
host.AddServiceEndpoint(typeof(ServiceReference2.IHREmployee),binding1, baseAddress);
}