What is <client> element of app.config ?
Why it’s added to client side when i add service reference?
How can i access this element programmatically ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s the counterpart to the
<service>section on the WCF service side. It’s primarily used to configure the endpoints used to connect the client and service together. In other words, it says where to connect to the service, and which binding to use.For example if you have a WCF service hosted in IIS, you might have a section like this:
So on the client side, you would have a corresponding set of entries for the
<client>section, e.g.There should generally be no need to access this section programmatically. Adding the service reference to your project would have added the proxy classes to your project though, and when using these classes you can specify the endpoint to use there. For example say you called your service classes “MyService”, you may initialise it like this:
There’s no need to actually specify it in the constructor like this unless you have multiple endpoints though.