Aracılığıyla paylaş


Asynchronous Find Sample

This sample shows how to use the asynchronous find operation from a client application.

Sample Details

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.

Note

This sample uses HTTP endpoints and to run, proper URL ACLs must be added. For more information, seeConfiguring 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

  1. Using Visual Studio 2010, open the AsyncFind.sln.

  2. Press CTRL+SHIFT+B to build the solution.

  3. Open a Visual Studio 2010 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.

  4. 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.

  5. Observe the client is able to locate and call the service.

Dd483344.Important(en-us,VS.100).gif Note:
The samples may already be installed on your machine. Check for the following (default) directory before continuing.

<InstallDrive>:\WF_WCF_Samples

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.

<InstallDrive>:\WF_WCF_Samples\WCF\Basic\Discovery\AsyncFind