If I want to remove necessity of app.config configuration from my Client side code and initialize client from my c#. Defining Bindings and EndPoint in my C# code. What would be ac# version of following client side code:
<client>
<endpoint address="http://employeetstsvc/Employee.svc" binding="wsHttpBinding"
bindingConfiguration="StandardEndpoint" contract="ServiceReference2.IHREmployee"
name="StandardEndpoint" />
</client>
Any ideas?
Something like below. See more 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);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.