Discover a Service with Unique Listen Uri Mode Sample
This sample demonstrates how to discover a service that has the ListenUriMode property set to Unique. When the ListenUriMode property is set to Unique, the ListenUri is ensured to be unique by either setting the port to be unique or for the path to be unique by appending a GUID.
This client connects to the service using the correct Via.Uri by using the Find method. The FindResponse that is returned from the method is then queried for whether it contains a valid ListenUri and whether it is different than Address.Uri. The appropriate information is then passed to the InvokeCalculatorService method. In the InvokeCalculatorService method, the ListenUri was passed in by the caller, then a ClientViaBehavior with the correct Via.Uri is added to the client’s endpoint.
To use this sample
Using Visual Studio 2012, open UniqueListenUriMode.sln.
To build the solution, press CTRL+SHIFT+B.
Run the service application, which is generated in the [solution base directory]\service\bin\debug folder.
Run the client application, which is generated in the [solution base directory]\Client\bin\debug folder.
The client locates the running service and writes to the console the metadata published by the service’s endpoint.
The samples may already be installed on your machine. Check for the following (default) directory before continuing.
If this directory does not exist, go to Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4 to download all Windows Communication Foundation (WCF) and WF samples. This sample is located in the following directory.