all groups > visual studio .net debugging > august 2006 >
You're in the

visual studio .net debugging

group:

Unable to debug a C++ Web Service in VS2005


Unable to debug a C++ Web Service in VS2005 Mark Oliver
8/21/2006 12:00:00 AM
visual studio .net debugging:
Hi,

I did post this in the DotNet VC group as it's a C++ only problem, however
it was suggested that I post it here so apologies for the cross-post.

I'm trying to create a web service using managed C++ in Visual Studio 2005.

If I make a service in Visual Basic it's fine, it all works correctly.

With C++ I can make the web service using the new project but I can't get it
to debug. I get a "Server Application Unavailable" error in my browser an
"aspnet_wp.exe (PID: 2604) stopped unexpectedly" error in my event log.

However if I then call the compiled web service straight from my browser
then it works. Therefore it's something to do with debugging but I can't
see what.

Looking some more at the differences between the VB and C++ service the
output window of the C++ one records the following:

The program '[4076] aspnet_wp.exe: Native' has exited with code 0 (0x0).
The program '[4076] aspnet_wp.exe: Managed' has exited with code 0 (0x0).

The VB web service also seems to be running through an ASP.NET Development
Server on Port 4070 rather than my usual web server.

Both projects are just the initial "Hello World" ones that the "new project"
wizard creates.

Any suggestions?

Thanks in advance,

Mark Oliver



A bit more information Mark Oliver
8/21/2006 4:23:23 PM
Hi,

OK I'm still trying to get this working....

Visual Basic Web Services work in both 2003 and 2005.

C++ Web Services work in debug mode in neither.

Both are loading up what appears to be the correct version of aspnet_wp.exe:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_wp.exe
and
c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_wp.exe

However both seem to be calling the same debugger:
C:\Program Files\Common Files\Microsoft Shared\VS7DEBUG\msdbg2.dll

Should they be sharing that?

I'm tempted to give up and use VB.Net but I really want a C++ solution.

Thanks again,

Mark Oliver

RE: A bit more information stcheng NO[at]SPAM online.microsoft.com
8/22/2006 12:00:00 AM
Hello Mark,

From your description, you're encountering some problem when try using the
"F5" to launch the debugging session of a Visual Studio 2005 c++ webservice
project, correct?

Based on my understanding, vs 2003 and vs 2005 support two kinds of C++
webservice projects:

** ASP.NET webservice

** ATL Server webservice

Since you also mentioned the aspnet_wp.exe process, I think it is likely
that you're developing through the "ASP.NET webservice" project on a XP box
since aspnet_wp.exe is the worker process of ASP.NET application on windows
XP/IIS5.

As you mentioned, the IIS virtual directory's extension mapping (ASP.NET
version) has been set correctly and the correct version of aspnet_wp.exe is
launched, the problem should be related to some other configuration
setting. Currently, I'd suggest you perform the following test(let's focus
on vs 2005 ASP.NET C++ webservice first):

1.If possible, I suggest you create the C++ ASP.NET Webservice on a windows
2003/IIS6 machine and test to see whether you get the same results. You
should configure the ASP.NET webservice virtual directory to use a separate
application pool in IIS6.

2. For your current problem webservice on the IIS5 machine, instead of
visiting it through webbrowser, try creating a .net console application(c#
or vb.net) and create webservice proxy (add web reference) against the
webservice and call it to see whether it works? If this also fails, it
indicate that the problem is likely specific to the webservice deployment
rather than the debugging service.

3. On IIS5 machine, the ASP.NET application will always be hosted in
aspnet_wp.exe process, and if you have multiple ASP.NET applications, the
runtime will likely host them in the same aspnet_wp.exe process. And when
there has already an ASP.NET 1.1 application hosted in one aspnet_wp.exe
process, if an ASP.NET 2.0 application is loaded into the same process
later, the 2.0 application won't work because the runtime is the .net
framework 1.1 loaded originally. For this case, you can perform a
"iisreset" on your development box to ensure all IIS application processes
are cleared. And then, only start your ASP.NET C++ webservice (debug or
normal launch) to see whether it works.

4. In addition to "F5" debug, you can also try use the "Debug--->Attach to
Processes...." menu to explicitly attach to the aspnet_wp.exe process(which
host your C++ ASP.NET webservice) to see whether such debuggign works.

So far I have performed some local tests through creating ASP.NET C++
webservice on XP and 2003 server machine and the debugging can work on both
F5 or manual attach mode, and it can works well. I think we need to perform
some further research to identify the certain cofiguration or environment
setting that cause the problem.

If there is anything I missed or if you wonder any other information,
please feel free to let me know.


Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



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://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================



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









Re: A bit more information Mark Oliver
8/22/2006 4:10:51 PM
Hi,

Yes the project is a .NET Web Service on an XP box and the problem occurs
when I try to launch the Web Service with F5 from Visual Studion.

I'll run through your suggestions:

1) I'm unable to get access to a 2003 machine to test this out. I have
replicated the problem on another XP machine though.

2) I've been able to create a Windows application and that debugs correctly.
The problem is something particular to debugging of web services.

3) I still get the same problems after doing an iisreset

4) I've had success with attaching to the process, it then lets me debug the
application correctly.

So thank you very much for your help, you've let me get stuck into the
project now.

If you can give any further assistance as to understanding what the actual
problem might be that stops the debugger starting and attaching itself then
I'd appreciate that.

Thanks again,

Mark Oliver

Re: A bit more information stcheng NO[at]SPAM online.microsoft.com
8/23/2006 1:53:31 PM
Hello Mark,

Thank you for the followup.

Yes, we can conclude that the problem is specific to webservice project. As
you said that you can reproduce the problem on another XP box, are you also
using a simple c++ ASP.NET webservice project(new created) for testing? If
it is a specific to a particular project, you can send it to me so that I
can perform some local tests against.


I've reviewed your last reply and found that you've tested some C# and
VB.NET webservice project and they can be debugged correctly, correct?
Also, you've mentioned the following things:

==================
The VB web service also seems to be running through an ASP.NET Development
Server on Port 4070 rather than my usual web server.
==================

I think this is because you're using the "FileSystem" option when creating
the VB.NET or c# webservice project, in such mode, VS 2005 will use the
test webserver (not IIS) to host your webservice/webform application. This
is a new featuer of VS 2005 which can help us develop web application
without IIS.

However, I suggest you create a VB.NET or c# webservice application through
local IIS option. By the following steps:

File -> New -->Web Site --- > ASP.NET Webservice

And in the "location" dropdownlist below, choose "http" rather than
"filesystem". Thus, it will let you input a http virual address of your web
service application. After you type a valid virual address on your local
machine's IIS server and created the appilcation, the webservice
application is hosetd in normal IIS webserver(by default listening on 80
port).

After the above steps, go to IIS ensure that the webservice(C# or VB.NET)'s
virtual directory is configured as ASP.NET 2.0 VERSION, and it has enabled
"integrated windows authentication". Then, in VS 2005 use F5 to launch the
debugger to see whether you can correctly debug the webservice project.


If the above IIS hosted c#/VB.NET webservice also suffer the same issue, it
seems the machine has something incorrect with debugging web application in
IIS(F5) rather than specific to C++ asp.net webservice.


Please let me know your test result or if you got any further finding.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



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://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================



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





Re: A bit more information stcheng NO[at]SPAM online.microsoft.com
8/25/2006 12:28:33 PM
Hi Mark,

How are you doing on this issue, have you got any progress? If there is
still anything we can help, please fee free to post here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.
AddThis Social Bookmark Button