Share via


Exercise 2: Verification

  1. Right-click EchoService.svc, and select View in Browser, to open the service in a new browser instance.
  2. You should now see a service page with a link to the WSDL because of the enabled serviceMetaData behavior.

    Figure 6

    EchoService now has metadata enabled

  3. Copy the URL of the service from the browser address bar.
  4. Start the WCF Test Client. To do this, open a Visual Studio Command Prompt (2010), type the following command, and press Enter.

    Visual Studio Command Prompt (2010)

    C:\>WCFTestClient

  5. In the WCF Test Client, select File / Add Service, paste the URL from the browser into the endpoint address and click OK.

    Figure 7

    Add the service to the WCF Test Client

  6. After the service has been loaded, double-click the Echo() method, set the value of the message parameter to Test, and click Invoke. The service will echo back “Echo: Test”.
  7. Invoke the service again – clear the value Test, and click Invoke with an empty value.

    Figure 8

    The server reports an internal error

  8. When debugging your service it can be helpful to see the exception details. Switch back to Visual Studio 2010, open the Web.config file and change the serviceDebug behavior to set the includeExceptionDetailInFaults attribute to true.

    Web.config

    <serviceDebug includeExceptionDetailInFaults="true" />

  9. Save Web.config this will cause the app domain to recycle.
  10. Switch back to the WCF Test Client.
  11. Invoke the service again with an empty value – check the Start a new proxy checkbox, and click Invoke.
  12. This time you will see the exception message in the WCF Test Client because the serviceDebug behavior.

    Figure 9

    The serviceDebug behavior including exception details

Next Step

Exercise 3: Default Binding