How to: Debug a Self-Hosted WCF Service
This topic applies to:
Edition |
Visual Basic |
C# |
C++ |
Web Developer |
---|---|---|---|---|
Express |
||||
Standard |
||||
Pro and Team |
Table legend:
Applies |
|
Does not apply |
|
Command or commands hidden by default |
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:
Manually attach the debugger to the hosting process. For more information, see How to: Attach to a Running Process.
— or —
Start debugging the client, and then step into a call to the service. This requires that you enable debugging in the app.config file. For more information, Limitations on WCF Debugging.
To start both client and host from Visual Studio
Create a Visual Studio solution that contains both the client and server projects.
Configure the solution to start both client and server processes when you choose Start on the Debug menu.
In Solution Explorer, right-click the solution name.
Click Set Startup Projects.
In the Solution <name> Properties dialog box, select Multiple Startup Projects.
In the Multiple Startup Projects grid, on the line that corresponds to the server project, click Action and choose Start.
On the line that corresponds to the client project, click Action and choose Start.
Click OK.
See Also
Tasks
How to: Step into WCF Services