共用方式為


WcfSvcHost and WcfTestClient in VS 2008

There are two nice helper apps included in Visual Studio 2008, which allow you to test-host your WCF service and invoke the methods to check they're working correctly.

The two apps are called WcfSvcHost.exe and WcfTestClient.exe.

By default they are set as default debugging activity in all WCF libraries. See how to get use of them:

  1. Create a new WCF Service Library
    image
  2. Build an interface "ISayMyNameService" with a class parameter named "Name"
    image 
  3. Implement a new service class
    image
  4. Change the class name of the hosted service in app.config:
    image
  5. Press F5 and start debugging.
  6. Voila - the WcfSvcHost is started an displays a successfull message. Click on the message for details:
    image
  7. At the same time the WcfTestClient got started and is now displaying a n UI for testing our simple WCF service. Double click on "HelloYou()" to invoke the method with parameters:
    image
  8. Press "Invoke" and wait for the service to complete. You'll then get back the response as a formatted list or in raw XML.
    image
  9. If you don't want the WcfTestClient, but your custom test client you can change the setting under the project properties:
    image

Comments