I have a number of different applications that implement the same contract. In my main app, I would like to have one proxy. Then dynamically, given a Uri for a particular application, I would create a web service request and call that. How can that be accomplished? Thanks!
I have a number of different applications that implement the same contract. In my
Share
Do these steps:
this will generate the C#/VB.NET classes for you, as well as the
app.config(orweb.configif your client is a web app)when calling the default service endpoint, you can do something like:
This will use all the settings from the default service endpoint as defined in your config file
if you need to provide a different endpoint, do this:
There is an overload for the client constructor which will take two parameters: the name of the endpoint configuration in your client config file (you need to look that up after you’ve added the service reference), and the endpoint URL you want to connect to (which can be different from what’s stored in the config).
If all the other parameters like service contract, binding information etc. stay the same, this method should work and it should allow you to connect to any number of varying endpoints using this second constructor overload.