Visual Studio 2010 and Multiple Config Files

I have a project that I am working on, and I have multiple config files for it. It is a WCF project, to be more specific. I would like to be able to choose which config file I would like to use for a compile (whether web.config or app.config). Is it possible to switch back and forth between different config files?
aceswildab1Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
regevhaConnect With a Mentor Commented:
It is not required to hardcode the binding nor the endpoint. You may create a client without specifying endpoint and binding, and the client will use the definitions in app.config
0
 
regevhaCommented:
The config file takes effect only in runtime and it can include one or more services, each one with one or more bindings. You can use the following code if you would like the Binding and the EndpointAddress to be dynamic:
// using System.ServiceModel;
WSHttpBinding binding = new WSHttpBinding();
EndpointAddress endpoint = new EndpointAddress(new Uri("http://localhost:9000/MyService"));
MyServiceClient client = new MyServiceClient(binding, endpoint);

Open in new window

0
 
aceswildab1Author Commented:
I was wanting to only use the config files and not have to hard code anything in. Is it possible to do this with config files or only hard coding end points in?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.