How to: Select a Service Endpoint
Some Windows Communication Foundation (WCF) services expose multiple endpoints through which a client may communicate with the service. For example, a service might expose one endpoint that uses an HTTP binding and user name / password security and a second endpoint that uses FTP and Windows Authentication. The first endpoint might be used by applications that access the service from outside a firewall, whereas the second might be used on an intranet.
In such a case, you can specify the endpointConfigurationName as a parameter to the constructor for a service reference.
Your computer might show different names or locations for some of the Visual Studio user interface elements in the following instructions. The Visual Studio edition that you have and the settings that you use determine these elements. For more information, see Visual Studio Settings.
To select a service endpoint
Add a reference to a WCF service. For more information, see How to: Add, Update, or Remove a Service Reference.
In the Code Editor, add a constructor for the service reference:
Replace ServiceReference with the namespace for the service reference and replace Service1Client with the name of the service.
An IntelliSense list will be displayed with the overloads for the constructor. Select the endpointConfigurationName As String overload.
Following the overload, type = ConfigurationName, where ConfigurationName is the name of the endpoint that you want to use.
If you do not know the names of the available endpoints, you can find them in the app.config file.
To find the available endpoints for a WCF service
In Solution Explorer, right-click the app.config file for the project that contains the service reference and then click Open. The file will appear in the Code Editor.
Search for the <Client> tag in the file.
Search underneath the <Client> tag for a tag that starts with <Endpoint.
If the service reference provides multiple endpoints, there will be two or more <Endpoint tags.
Inside the <EndPoint tag you will find a name="SomeService" parameter (where SomeService represents an endpoint name). This is the name for the endpoint that can be passed to the endpointConfigurationName As String overload of a constructor for a service reference.