How to debug a web service in a C # /. NET solution from a web application

I have an application solution consisting of eight projects in C # /. NET with web services.

One of the projects is web services.

All data is retrieved through web services in a Windows Forms application.

But while debugging my Windows application, I cannot debug web services called to retrieve data in Visual Studio 2010.

How to debug a web services project in a solution when data sampling events are fired?

+9
c # web-services visual-studio-2010 visual-studio-debugging
source share
5 answers

Typically, when debugging in Visual Studio, the selected StartUp project will be executed in debug mode. In your case, you need to run and debug both the web API project and the WinForms project. You can do this by right-clicking in the solution explorer and selecting Install StartUp Projects . A dialog box opens in which you can select Multiple launch projects , and then choose which projects to run when debugging a solution.

Solution Property Pages

Another option is to have one StartUp project (a web API project, since it is a requirement to run another project). Then you can right-click the WinForms project in the solution explorer and select DebugStart New Instance . You can do this several times to debug multiple instances of the same project.

Obviously, you can always attach a debugger to any running process, and if your web API is deployed using IIS, it will already be running. Using the procedure described above, Visual Studio joins the correct workflow.

+17
source share

You can debug web service by attaching the VS debugger to the process as follows:

 Debug > Attach to Process > Attach 

You can browse the available service you are looking for and attach.

+3
source share

You must attach Visual Studio to the hosting of your web service.

This process is usually an IIS workflow, whose name is w3wp.exe in IIS 6+ on Windows Server 2003, Vista, later.

To connect to this process, you can use Debug -> Attach to Process in visual studio. Inside the Attach to process dialog box, make sure you check Show processes from all users , and when your process is selected, make sure Managed code selected. To select a managed code, click Select... and check the Managed code box (V2.0 or V4.5.4.0 depends on your choice of framework).

+2
source share

You can join the process of your web service. In Visual Studio, select the menu Debug → Attach to Process.

0
source share

This is the writing of 2019, the solution is to attach to IISExpress. Debugging → Attach → find iisExpress (not in tray) in the list.

0
source share

All Articles