Breakpoint on a web service

O

Oriane

Hi,

I have a .Net Visual Studio solution with one asp.net Web application, which
uses a Asp.Net Web service. Both are compiled in debug mode, and both are
using the Studio development web server for debugging. I have also add the
Web reference to the web service with the "Add Web service in the solution"
choice, that is the Web app starts the Web service with the Studio
development web server.

So I thought I could set breakpoints on the web service C# code. But as soon
as I start the main web app, the breakpoints are turning yellow with a
exclamation mark and they don't stop anything.

Did I miss something ?

Best regards
 
J

Jeff Dillon

Oriane said:
Hi,

I have a .Net Visual Studio solution with one asp.net Web application,
which uses a Asp.Net Web service. Both are compiled in debug mode, and
both are using the Studio development web server for debugging. I have
also add the Web reference to the web service with the "Add Web service in
the solution" choice, that is the Web app starts the Web service with the
Studio development web server.

So I thought I could set breakpoints on the web service C# code. But as
soon as I start the main web app, the breakpoints are turning yellow with
a exclamation mark and they don't stop anything.

Did I miss something ?

Best regards

Are they both part of the same solution?
 
H

Hongye Sun [MSFT]

Hello Oriane,

Thanks for your post. My name is Hongye Sun [MSFT]. It is my pleasure to
work on this issue for you.

From your description of the symptom, I understand that It is very easy to
confuse people when they are developing multiple websites, including web
service, at the first time. So I will explain the cause and the solution
from scratch to help you to understand.

=== CAUSE ===
First let us clarify how the website works. Website including web service,
they cannot be working individually. Every website of ASP.NET must be
hosted in a web server process. A web server process in windows is a
typical windows process. For example, IIS is a web server, which will run a
windows server process (named w3wp.exe in win2k03) to host websites.

Next, how can we debug the code of a website? A windows process is the
basic unit that we could attach debugger to. So if we want to debug on
website, we should first attach the debugger to the web server process.

Now let us take a look of how the web server hosts website in Visual
Studio. In VS 2008, it supports two types of web server. One is IIS and the
other is built-in ASP.NET Development Server. When one or multiple websites
are run in IIS, they will be all hosted in IIS service process as we
mentioned before. If one or multiple websites are run in built-in ASP.NET
Development Server in Visual Studio, Visual Studio will create built-in web
server process for each website.
We can check what type of web server that we are using by opening website
properties, select "Start Options" in the menu and view "Server" section on
the right side. If we are using default web server, that means built-in web
server. Or we are using custom server, that means external web server like
IIS. By default, it is using built-in web server. For more information
about web server in Visual Studio, please visit:
http://msdn.microsoft.com/en-us/library/58wxa9w5.aspx.

For your scenario, I suppose that your website and web service are all
hosted by built-in web server. So when you run them, there will be two
built-in web server processes started by Visual Studio. If you want to
debug two projects, the debugger should attach to both of the web server
processes. However, Visual Studio does not know about that. It just
automatically attaches to startup website's web server process when
clicking start debugging, while the web server of web service is not
attached. That's why you cannot debug web service code.

=== SOLUTION ===
Before starting debugging, please make sure that in Web.config files in
both website and web service project, the compilation debug is set to true.
After clicking "Start Debugging" button. Please do actions as below:
1. Click top menu item "Debug". In its expanding menu, select "Attach to
Process". (or press shortcut key ALT+SHIFT+P)
2. The "Attach to Process" dialog is shown up and there will be two
processes named "WebDev.WebServer.EXE".
3. Select one that you can attach to. Since the other is already attached,
you will see it gray out and cannot attach to it.
4. Click Attach button.
You can view the attached processes by opening from menu:
Debug->Windows->Processes, when VS.net is in a debug mode.
For how to attach debugger to a process, please visit:
http://msdn.microsoft.com/en-us/library/3s68z0b3.aspx.

After that, you should be able to debug web service code.

Please try the solution above and let me know if it works for you. I am
looking forward to your reply. Have a great day!

Regards,
Hongye Sun ([email protected], remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/default.aspx?target=assistance&ln=en-us.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.



=========================================================
From: "Oriane" <[email protected]>
Subject: Breakpoint on a web service
Date: Thu, 4 Sep 2008 18:21:52 +0200
Newsgroups:
microsoft.public.dotnet.framework.aspnet,microsoft.public.vstudio.general

Hi,

I have a .Net Visual Studio solution with one asp.net Web application,
which
uses a Asp.Net Web service. Both are compiled in debug mode, and both are
using the Studio development web server for debugging. I have also add the
Web reference to the web service with the "Add Web service in the solution"
choice, that is the Web app starts the Web service with the Studio
development web server.

So I thought I could set breakpoints on the web service C# code. But as
soon
as I start the main web app, the breakpoints are turning yellow with a
exclamation mark and they don't stop anything.

Did I miss something ?

Best regards
 
O

Oriane

Hi Hongye,
"Hongye Sun [MSFT]" said:
Hello Oriane,

Thanks for your post. My name is Hongye Sun [MSFT]. It is my pleasure to
work on this issue for you.
[...]> After that, you should be able to debug web service code.
Please try the solution above and let me know if it works for you. I am
looking forward to your reply. Have a great day!
I didn't have the time up to now, but I will try next week.

Thank you very much.
 
H

Hongye Sun [MSFT]

Hi Oriane,

It is always our pleasure to help you. If you have any problem when
implementing the solution, please feel free to let me know. I will try my
best to reply you at the first time.

Have a nice day!

Regards,
Hongye Sun ([email protected], remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,967
Messages
2,570,148
Members
46,694
Latest member
LetaCadwal

Latest Threads

Top