14

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

One of the projects is of web services.

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

But while debugging my Windows application I am unable to debug the web services called for fetching the data in Visual Studio 2010.

How do I debug a web services project in a solution when data fetching events are fired?

0

5 Answers 5

22

Normally, when debugging in Visual Studio the selected StartUp project will be executed in debug mode. In your case you need to start and debug both the Web API project as well as the WinForms project. You can do that by right-clicking in the solution explorer and selecting Set StartUp Projects. A dialog box opens where you can select Multiple startup projects and then select which projects to start when debugging the solution.

Solution Property Pages

Another option is to have a single StartUp project (the Web API project as this is a requirement for the other project to run). You can then right-click on the WinForms project in the solution explorer and select Debug -> Start new instance. You can do this multiple times to debug multiple instances of the same project.

Obviously, you can always attach the debugger to any running process and if your Web API is deployed using IIS it will already be running. Using the procedure outlined above Visual Studio will attach to the right worker process.

Sign up to request clarification or add additional context in comments.

1 Comment

Can't believe that 3 out of 4 answers suggest to attach the process instead of use multiple startup projects... which works also but is a pain if you have to debug a lot..
4

You should attach Visual Studio to the host process of your web service.

This process is usually the IIS worker process which name is w3wp.exe on IIS 6+ on Windows Server 2003, Vista , later.

To attach to this process, you can use Debug -> Attach to Process in visual studio. Inside the Attach to process dialog box Make sure you've checked the Show processes from all users and also when selected your process, make sure that Managed code is selected. To select managed code click Select... and check the Managed Code checkbox (V2.0 or V4.5,4.0 depends on your selection of framework)

Comments

3

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

Debug > Attach to Process > Attach

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

Comments

0

You can attach to the process of your web service. In Visual Studio, click menu DebugAttach to process.

Comments

0

This writing is 2019, solution is to attach to IISExpress. Debug -> Attach -> find iisExpress (not the tray) in the list, .

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.