WCF remote debugging fails - no symbols loaded - c#

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

Related

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.

ASP.NET failing to call an unmanaged dll after initial request

So I have an unmanaged C++ dll which I am calling from my ASP.NET application, it has a single entry point and a couple of structures for passing data. If I create a C# console app to call the dll it works fine. If I hook it in to my asp.net app running on my local WinXP machine (IIS 5.1) then it works fine.
When I publish it to our development environement which is running Windows 2003 and IIS 6 then the first 1 or 2 calls works fine but then it simply stops responding. I'm getting no error messages, warnings etc... but I am fast running out of hair!
I've set the virtual directory which runs the asp.net app up inside of its own application pool but this seems to have had no impact. Any help would be greatly appreciated.
Cheers
What do you mean when you say that it stops responding? You could try putting logging statements that would trace the input/output around the call to see where exactly it blocks. Also make sure you check the server Event Log where unhandled ASP.NET errors are written. As a last resort you could install Visual Studio remote debugging tools (msvsmon.exe) on the server and step through the code by attaching to the corresponding w3wp process. Actually the debugging tools doesn't require installation, a simple copy is enough (C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\Remote Debugger).
The failure appears actually to be with the C++ code itself, it has some code to handle locking for a threaded environment and this appears to be failing. Not sure why it works on my local machine and not the dev environment but that's another question.
Thanks all

Windows Service in C# works on dev machine, crashes in test environment

I have been working on an application using .NET 4 and c# in Visual Studio 2010 Express. It's purpose is to watch a directory and import any documents it finds into our imaging system.
I included an installer class which provides the information needed by installutil.exe.
So to install locally, I build the solution, and then at command line:
installutil.exe MyProjectExecutable.exe
Which installs it as a service. This works fine in my development environment.
To deploy to the test environment, I use the same method:
installutil.exe MyProjectExecutable.exe.deploy
Except of course the executable has a second extension, .deploy. This is the way the application is published by Visual Studio. Everything works up tot his point
Here is the problem: once I have done this, I run the service and it starts properly, as indicated in the log file. However, once it detects files in the directory, the service will not do anything with them and will eventually crash. The only way I can tell it has crashed is to look in the windows Event Viewer. It will show the message:
"An unhandled win32 exception occurred in MyProjectExecutable.exe.deploy [4108]. Just-In-Time debugging this exception failed with the following error: Debugger could not be started because no user is logged on."
Two questions:
1) What could be causing this
2) Am I going through the correct steps to install a windows service, or is there a better way?
Both environments have .NET 4 installed.
In both environments I am placing the same documents in the import directory.
In both environments the service runs under the Local System account.
If my question reflects a lack of C# experience, my apologies in advance.
subscribe to AppDomain.UnhandledException Event
Are you watching a directory under 'Documents and Settings?' You mention that you're running under Local System, but is that in the C# code or in the Services Panel?
Start->Run
services.msc
< Find your App >
Right-click, Properties
Log On Tab
Log On As
This Account
< Plug in a user / pass with permissions >
In my experience this it is always a security problem. Check the rights that the service running user has. Can it access the folders you are monitoring and make the needed changes?
I have found the problem. in the config file, the listen directory was "c" whereas it should have been "C". Until now, I didn't think Windows was case-sensitive. Thanks for the help guys.

Error 1053: the service did not respond to the start or control request in a timely fashion

I know this question has been asked twice.But both of them didn't help me.My code is working fine like onstart is for initialization the timers etc.
I have C# windows service which is running as some accnt not local.
Im currently using CCtray to deploy and start the service so it doesn't give me any error.
But sometimes manually I need to stop and start it again.And that's where I see this msg.
I know microsoft has a hotfix for sp1 but I don't know whether they have for sp2.And my server where service is located is sp2.
I know microsoft has a hotfix for sp1 but I don't know whether they have for sp2.And my server where service is located is sp2.
If we made a hotfix for SP1, the fix is already in SP2. Also, don't do anything in the OnStart, start up a separate thread to do anything and respond to SCM requests as fast as possible.
One other reason is If you copy the DLL in 'debug' mode to installation folder this issue will come.What you need to do is Run the project in 'Release' mode copy the DLL or directly form Release folder rather than Debug folder,,and copy that DLL in to installation folder,it will work.You can see the reduction in size of DLL ,it will not contain any debug symbols and like that

Categories