How to: Debug a Self-Hosted WCF Service

A self-hosted service is a WCF service that does not run inside IIS, the WCF Service Host, or the ASP.NET Development Server. The easiest way to debug a self-hosted WCF is to configure Visual Studio to launch both client and server when you choose Start Debugging on the Debug menu.

If the WCF service is self-hosting inside or a process that cannot be launched in this manner, such as NT service, you cannot use this method. Instead, you can do one of the following:

To start both client and host from Visual Studio

  1. Create a Visual Studio solution that contains both the client and server projects.

  2. Configure the solution to start both client and server processes when you choose Start on the Debug menu.

    1. In Solution Explorer, right-click the solution name.

    2. Click Set Startup Projects.

    3. In the Solution <name> Properties dialog box, select Multiple Startup Projects.

    4. In the Multiple Startup Projects grid, on the line that corresponds to the server project, click Action and choose Start.

    5. On the line that corresponds to the client project, click Action and choose Start.

    6. Click OK.