Remote Debugging vs2012 "No symbols have been loaded for this Document" - asp.net

I'm using VS2012 to try to remote debug a service running on a remote server on our network.
I have created a shared folder on the remote server that points back at my development machine and allows me to start the msvsmon.exe 64 bit
I have copied the dll and pdb files from my dev machine to the server for the service i wish to debug. These files are identical.
I can attach to the remote process.
At which point my breakpoints state "No symbols have been loaded for this Document".
"Enable just my code" is NOT ticked.
Service web.config has Debug="true"
I've restarted the appPools since loading my assemblies.
When i debug locally the loaded modules window shows the assemblies i want to debut as "Symbols loaded" If i attach remotely the none of the assemblies even appear in the list.
I'm not sure if this is important for remote debugging or not. If it is I don't know how i can fix this.
Assemblies and pdb files are together in the same folder on the remote server.
However, i read that the dll and pdb files must be the same file structure as on the DEV machine.
I don't know if this is right, but i don't see how this would be possible. VS structure are individual project and solution. Once deployed the assemblies all sit in the same bin folder.
Can any one provide any additional possible causes for this issue ? Can the loaded modules issue be fixed if indeed it is an issue?
Thanks

Related

No pdb file created in output directory for .dll in VS2012 MVC web app

I am trying to debug a web app that I am running under IIS and localhost by attaching to the w3wp worker process.
I am getting the following message on my breakpoints when attached to the process:
This breakpoint will not be hit. No symbols loaded for this document
I have cleaned and re-built the solution numerous times so I am certain the cause of the problem is not that my code is out of sync with my app.
I have checked the modules view and can see that the symbols have been loaded for all the project dlls apart from the web project. The web.dll has a symbol status of
No symbols loaded
and when I check the output path I can see the web.dll but no web.pdb. All the other project dlls are present as are their corresponding pdb files.
Is there anything obvious that I am missing here?
Have a look at the build configuration manager. Make sure they are all set to debug

Location of symbols for WCF remote debugging

This is more a 'why does this work this way' than a 'how do I make this work' sort of question.
I have a WCF web service I am debugging remotely. It is deployed to a staging server where the VS 2010 remote debugger is installed and running as a Windows service. The permissions are correct, I can attach to processes without any problem. The issue I ran into is I couldn't consistently get the symbols to load.
I have the WCF service deployed to C:\Webs\MyService, with assorted DLLs in C:\Webs\MyService\bin. It is set up as a separate site with its own app pool. What I found is even if I had the necessary .pdb file in the bin folder, Visual Studio wouldn't load any symbols when I attached to the w3wp.exe process from my local machine. What was happening is when IIS started and the worker process was spawned, my service DLL would get copied deep under the temp ASP.NET files directory, into something like C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\19f82539\e55fff8f\assembly\dl3\2926a261\f625d158_f62ecd01. I found that if I manually copied the .pdb file to this folder, then symbols would be loaded and I could do the debugging.
I'm wondering why the heck it works that way, and how I can avoid having to manually copy the symbol file to this other directory. What's worse is if I had to make changes and redeploy, the worker process wouldn't recognize them. I had to restart IIS which caused a different temp directory to be created, requiring me to copy the .pdb again.
I have a similar problem, with web applications. Apparently Microsoft are aware of this: http://go4answers.webhost4life.com/Example/remote-debugging-symbols-not-loaded-207525.aspx
Hopefully, they will release a fix soon.
There is also a suggestion by BrianR on a related question, Why are no Symbols loaded when remote debugging?, saying to create a folder with the debug files and on the remote server to point the environment variable _NT_SYMBOL_PATH to it.

Using SMO on web server with ASP.NET

Is it required to have anything SQL Server related installed on a web server in order to make use of SMO? I've built a web app that programmatically creates a SQL Agent job, adds a step (which ultimately fires of dtexec to run an SSIS package), and executes.
This works fine on my local machine which has SQL client tools installed, however when I move to a web server, I get reference issues and I'm starting to think it's due to something not being installed.
Could not load file or assembly 'Microsoft.SqlServer.SqlClrProvider, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies.
This is a rat hole.
The problem is that once you locate that assembly and copy it to the bin folder of your application it will complain about a completely different one.. or even the same file simply due to missing dependencies.
For more information read this: http://www.sqldbadiaries.com/2010/10/20/how-i-fixed-could-not-load-file-or-assembly-microsoft-sqlserver-smo-version10-0-0-0-issue/
That site lists the files you need and the fact you need to register and gac a few files. Quite frankly, you are much better off just biting the bullet and install the client tools on your web server.
Yes, your application requires this assembly in its bin directory to function. This error means that the server doesn't have the SMO (and its dependant) assemblies.
Back in your solution in Visual Studio, right click on the assembly above, and select/change the "Copy Local" to "True". Copy this for each SMO assembly that you've referenced.
When you publish your application, this will bring those .DLLs on your development machine along in your published bin directory.
Check your web.config file for any references as well
search your code for SqlClrProvider

copying ASP.NET project files with code to server

I know you can copy a Website intact to the server and have it run normally (security and compilation time aside).
What about the projects that are in the solution? [whose dll's are copied to the bin when built]. Is there a way to copy the projects' code files to the server as well?
My goal is to be able to debug [by modifying code in the project if needed] directly on the server without having to install an IDE [or keep building on dev machine and copying over dlls]. I can debug/modify the website files, but not the projects.
EDIT: to clarify, not just debug, but be able to edit.
So long as you upload both the DLLs and the PDBs, you should be able to debug successfully without the raw projects on the server. It can be augmented if you have open the matching project / solutions locally. There really isn't a requirement to upload solution, project, or raw code files to the server to debug effectively, remotely. It should be noted that breakig while debugging will hang the app domain on the target application, and as such, should be done with caution in a multiuser environment.
You do not need the project files in order to debug files.
You should read about remote debugging.
Update:
What you want to do sounds very dangerous in a production environment. If you want to develop, develop locally.
Regardless - project and solution files are organizational tools in visual studio as well as build files for the MSBuild build tool. If you don't have either visual studio or MSBuild installed on the server, there is little point in having the project and solution files on it.
Why do you need to develop on a production machine?

Breakpoint not hit when remote debugging on Internet for ASP.NET

I have sit up remote debugging on a Window 2003 server accessed through the Internet. I have VS 2008 SP1 installed on my XP dev box.
I launched the site on the remote server and attached to all the w3wp.exe processes on the remote server. I noticed that the .dll did not load the symbols file. When I try to load the corresponding .pdb file from my local machine, it says file does not match. I have "Require source files to exactly match the original version" unchecked. The assembly on the remote server is the same as the one on my dev box. The site and .dll was copied from dev boc to remote server and code hasn't changed since. So I know .dll and .pdb files should match or at least I need to force the matching.
Questions:
How do I get the .pdb file to load? I know breakpoints won't trigger unless symbols file is loaded. I noticed that the .pdb file does not exist in the "Temporary ASP.NET Files" folder on the remote server. The .dll does.
What's the proper sequence to start debugging remotely inside VS? (Remote set up is done and I can see remote processes).
In VS, I have start page as the url of the remote site. I start without debugging and then attach to w3wp.exe(s) on the remote. Is this all?
Are you running a Web Site or a Web Application (is it a compiled project, that you deploy the DLL for, or a collection of aspx and aspx.cs files that you deploy)?
If it's a Web Application, did you deploy a release build, or a debug build? You won't be able to hit breakpoints when "debugging" a release build, as the code is fairly heavily optimised.
Have you got "debug=true" set in the web.config compilation section? If not, again, debugging is going to be difficult.
Finally, the steps I use when remote debugging are:
Deploy latest debug build of files
Request page on remote server to start/restart application
Ensure that the VS Remote Debugging Monitor is up and running on the remote server
In VS, go to Tools (or Debug) | Attach to Process..., ensure that the remote server is selected in the Qualifier, and select w3wp.exe for the correct app-pool, etc.
Request page that will fire break point.
Debug!
If the breakpoints are hollow (thin red circles rather than filled disks), I'll often check the Stack window in VS to see what has and hasn't been loaded.

Resources