This sample shows how to use the asynchronous find operation from a client application.
The benefit of following this design pattern is that the client is notified asynchronously of the endpoints located as a result of the find request. To see how this works, open the Client.cs file. Note the DiscoveryClient object has two delegates attached to its event handlers. One delegate is called when a FindCompleted event is raised and another is called each time a FindProgressChanged event is raised. The sample shows how you can utilize this pattern in your application.
This sample uses HTTP endpoints and to run, proper URL ACLs must be added. For more information, see Configuring HTTP and HTTPS. Executing the following command at an elevated privilege should add the appropriate ACLs. You may want to substitute your domain and username for the following arguments if the command does not work as is.
netsh http add urlacl url=http://+:8000/ user=%DOMAIN%\%UserName%
To set up, build, and run the sample
Using Visual Studio 2012, open the AsyncFind.sln.
Press CTRL+SHIFT+B to build the solution.
Open a Visual Studio 2012 command prompt and navigate to the \WCF\Basic\Discovery\AsyncFind\CS\service\bin\Debug or \WCF\Basic\Discovery\AsyncFind\VB\service\bin\Debug directory and run Service.exe.
After the service has started, navigate to the \WCF\Basic\Discovery\AsyncFind\CS\client\bin\Debug or WCF\Basic\Discovery\AsyncFind\VB\client\bin\Debug directory and run Client.exe.
Observe the client is able to locate and call the service.
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.