tags:

views:

36

answers:

2

Hi All,

I am developing a wcf service . I have created two dll's one for message contracts and one for service contracts interfaces. I share these two dll's with server and client. I am not using AddServiceReference i am using ChannelFactory class to create proxies. Following is the code which i am using to create client proxies:

BasicHttpBinding binding = new BasicHttpBinding(); 
EndpointAddress endpoint = new EndpointAddress(new Uri   ("http://localhost:8989/HelloService/"));
ChannelFactory<IHello> chanFac = new ChannelFactory<IHello>(binding, endpoint);
IHello clientProxy = chanFac.CreateChannel();

Now I have to create the binding and EndpointAddress in the code,what i want that this should come from app.config file , how can i do it so that i don't need to write binding and endpoint everytime in the code.... Any help is appreciated..

A: 

Wcf has a rich model for using Configuration files. It's really easy to do this. See here

For a client you use a

<system.serviceModel>
 <client .... /> 
</system.serviceModel>

section

Preet Sangha
A: 
marc_s