debugging asp.net web service remotely - c#

I'm trying to attach to a Web service remotely from Visual Studio (2008). I can attach to processes on the remote machine, but when I attach to w3wp.exe, the breakpoints in my code say "The breakpoint will not currently be hit. No symbols have been loaded for this document".
Something I noticed is that after attaching, the DLL of the service doesn't appear in the list of loaded modules, but I can see other DLLs referenced in the project...
Am I attaching to the wrong process? Only one w3wp.exe instance runs on the remote machine...
UPDATE
Apparently, the remote debugger needs to be installed to allow stepping into web services, it cannot be done if the remote debugger is running from a share.
Since I couldn't make it work and I don't have access to the VS 2008 installer to properly install the debugger on the remote machine, I decided to upgrade the project to VS 2010 (of which I do have the installer)...
However, I still have to manually start the debugger and add permissions to be able to attach... Is there any way you can set additional permissions when the debugger runs as a service?

If the debug symbol resources (*.pdb) are not right there with the libraries then I would say that your solution wasn't built for Debug but rather for Release (or some other build target).
I've personally not been able to attach the debugger to a project without those symbols being loadable. As a solution I'd recommend rebuilding the project for Debug and then deploying it to the suspect environment that needs your debugger.

Related

Can't debug Windows Service if it's installed by Visual Studio Installer

I've been debugging for a quite while the Windows Service I've been working with without any noticeable problems. I used to install it thourgh the installutil command and I was able to debug it (followed this MSDN tutorial).
Deploying the service to the production server meant so much pain in order to pack all dependencies, so I was encouraged to deploy it through some kind of installer.
Which one? "Quick and dirty" solution: Visual Studio installer
Everything is running fine until the point I needed to debug the installed server as I have been doing until now. I attach the Windows Service process but the debugger isn't stopping at my breakpoint.
What am I exactly missing?
While I was writing the question, I asked myself how did I configured the build properties. For my surprise, it was set to release.
I changed it to debug, uninstalled the service, installed it again and I finally had my service being debugged.
Bear in mind I always installed the service right-clicking on the project's name and clicking into "install". Seems this takes the installer placed on the specified build config.
Thing is this service is supposed to be installed uniquely on a production server. I was supposed to deploy always the release version in order to be completely clean and optimised, so I guess I will have to keep swapping this option, at least for my own workspace.
And yes, my installutil was pointing to debug build.

Remote debugging a Windows Service VS2010

I have developed a windows service on my system and have deployed the service on a target machine which does not have visual studio. Therefore, I need to debug the application from my PC. I already know how to debug a windows service on a local machine.
MY STEPS:
Copied the complete bin folder (containing .exe as well as .pdb files) to the target machine.
Installed the service on the target machine using InstallUtil.exe (i.e installUtil.exe "pathToMyServiceEXE/myService.Exe")
Started the service
Installed Visual Studio Remote Debugging application (started in "No Authentication mode" with Debugging option checked)
Attached to the service in Visual Studio (which is running on my PC)
PROBLEM: I am able to successfully attached to the windows service of the target machine. But it cannot find the symbols.
I have checked other SO questions about the same problem but could not find the correct solution so far. I have tried the following things to solve the problem:
Opened Tools->Options->Debugging->Symbols and then put the path of .pdb files on my local PC. (Didn't work)
Opened Tools->Options->Debugging->General and unchecked "Enable just my code".
In addition to above two, I have already made sure that I am running the x64 version of the Remote debugging tool, Debug/x64 version of windows service and debug/x64 on my local PC.
The best advice that I can give you - which is not the easiest now, but will pay off in the long run - is to use WinDBG debugger on the target machine. This is next to zero setup on the target machine but will require you to learn the basics of WinDBG. This is not trivial but will pay off in the long run.
Regarding why you cannot load symbols:
Maybe PDBs do not match binaries?
Maybe path is not accesible to the current logged-in user? (such as mapped drive, etc)
Maybe permission issue?
Other then that I think it should work

remote debugging asp.net

I have a server running my web app through IIS. I have visual studio locally, I am attaching to the remote w3wp.exe process with no issues, but my breakpoints are not being hit because my symbols are not loaded.
What am i missing?
Update: Should I be debugging Native or Managed? When I do Native, the Modules window shows a ton of windows dll's that all fail to open the PDB. Should I be concerned? I do not see my dll in the list. When I use Managed, the modules window is completely empty.
Found the issue. When I was attaching to the process via the Visual Studio gui, the w3wp.exe process was listed as x86 instead of Managed 4.0. I recreated my app's site in IIS and the process went back to being listed as Managed, which allowed the symbols to be loaded.
Make sure that you built your project in debug mode. Also, make sure you have sufficient rights for your remote server.

How to Test an IIS Module via Visual Studio?

I'm working on an IIS module written in C#. I'm trying to test out some different types of functionality which is slowing down the development process. Right now I make the code change, build it, move the DLL to my web folder and refresh the website in my browser. This means I have to follow the stack trace every time an error occurs.
Is there some way I can run this directly from Visual Studio so if an error occurs VS will catch it and display the details allowing me to step back and forth through it?
Thanks in advance!
As long ad IIS loading modules DLLs you should be able to attach Visual Studio debugger to the IIS working process, try out to attach to the w3wp.exe process

WCF remote debugging fails - no symbols loaded

I am trying to remotely debug wcf service on IIS 6. It has been working fine until yesterday. Now breakpoints are not being hit and warning message says "No symbols have been loaded for this document". I've solved this by restarting iis and app pool, but it worked just for a few days. Now I have the same problem. I've read almost all advices on the Internet about this, I've checked build options, GAC, ASP Temporary folder. When the service file is loading the VS is writing that my dlls is loaded. But when I looking at the debug->modules window it shows that this modules haven't been loaded. I still can see exceptions while debugging. Now I am temporarily using Debug.WriteLn() for debugging, but it takes a lot of time and effort. Any help will be appreciated.
P.S. I use VS 2010, WinXp Sp3 on my PC and Windows Server 2003 on server.
[Updated] Is there any patches for VS 2010 that can fix remote debugging problem ?
[Updated] I've noticed that w3wp process type is x86 now, although my service was called by client before and it should be managed type.
Finally, I 've found a solution. I copy my WCF output files to the same location on the server as in my pc. It is quite wierd but debugging works perfect.
Here is your answer, and the issue I ran into:
I've noticed that w3wp process type is x86 now, although my service
was called by client before and it should be managed type.
Typically to get the w3wp.exe process to actually show in the Attach to Process debug dialog is to just browse to a site in IIS locally. This will spin up that process and make sure it is available to select.
However, you must browse to a site using the same app pool type as the WCF service you want to debug. If you select an app pool using a 32-bit process (x86) and attach to this for a WCF service expecting a x64 version, the resulting "No symbols have been loaded for this document" will be displayed and breakpoints will appear as 'hollow' red circles.
First: Please Install IIS 7, its much recommended!
2nd: it happens sometimes with everyone I guess, deploying the service again with the options (Delete existing files (checked), with source code (checked) ), resolves the problem.
Actually that's the only solution is working in my case
Regards,
Mazhar Karimi

Categories