Remote-Debugging in Running Web Application - c#

We are trying to add a new page to a running web application. such that a new dll and aspx file are being added. I've setup break points in the code file and Built the application transfering the dll to the remote machine bin file and the aspx page to a folder within the web application. Note this folder is not in the same folder hierarchy as it built in. I'm not sure if thats the problem. Basically we are appending new functionality to a web application.
I've completed the following
I've copied the correct Remote Debug Monitor to the server and have it running.
I'm able to attach to the process which in this case is w3wp.exe (I've Identified that it is the correct process for my application.
I deployed the *.dll to the the bin folder with the *.pdb file along with it.
I've deployed the *.aspx file to the location we want.
With the file open in visual studio with breakpoints setup, we attach to the process and debug. I get 'No symbols loaded' and the breakpoint go empty.
I'm missing something it seems. I've searched the net but have only found complete publish\ deployment scenario.
Any thoughts

Tools -> Options -> Symbols -> Add the path to your deployed web application dlls and pdbs.
You might also need to uncheck "Enable Just My Code" under general debugging.
Here's a more detailed answer that got it working for me in the past: Remote Debugging is not breaking on errors

Related

C# Remote Debugger - Cannot find or open the PDB file

I'm trying to remote debug my application (C# windows application) according to Remote Debugging, I installed the Remote Tools on my remote machine, say it's RA, and I added permission for the machine I want to debug the application, say it's B.
I open VS in B, Click Debug->Attach to Process..., choose 'Remote =(no authenticated) in Transport, then click the Find button and I can find the machine RA. When I selected this machine and choose the application I'm going to debug, but when I attach it, there's a lot log messages showing that Cannot find or open the PDB file.
Since we need the pdb files to debug on our local machine, then how remote debugging find the pdb files? Or I didn't have it configured correctly on RA?
Confirm yourself that you can access the pdb files, located on RA, from B. First step is to make a network share of the directory where the pdb's are located on RA. Second step is to open a windows explorer on B and navigate to that specific network share. For example: \\RA-MACHINE\PDB-DIR. Log in with the correct credentials (RA-DOMAIN\RA-USER, RA-PWD) and tell it to remember your credentials for subsequent logins. The pdb-files should show up in the windows explorer. Configure where the debugger looks for symbol files, as described [here] and remote debugging should work.
According to https://msdn.microsoft.com/library/x54fht41(v=vs.100).aspx
By default, the debugger loads symbol files from the location where
your EXE is located. To use symbols from another directory or a symbol
server, you must specify the locations to Visual Studio.
If you use Azure pipelines with VS 2022 and your .pdb file is present in your web app, you have to publish manually in VS with a profile and then attach the debugger. I tried to get my pipeline to update the .pdb file but was unsuccessful. I never had this issue with VS 2019.

Where can i find an executable program once i have finished writing c# code

In visual basic class I learned where I could find the .exe file once the program was done and run at least once. Basically we could take the icon for the .exe file and place it on the desktop so that a user could just double click on the icon to run the program without needing to open the IDE or look at any code.
Where/how can i find this kind of file for c# code?
Go to the bin/Debug folder in the project. (or bin/Release if you're using the release build).
You can also go to your project settings, then to the build tab, and in the "Output" heading read/change the "Output Path" setting. This will let you output the exe to some other location, or just see where it is currently outputting in the event that it has already been changed on your machine.
Assuming you're using a web application project you'll use the .aspx file that is generated to access your silverlight application.
The "application" so to speak is actually a file ending in ".xap" that can be found in your web project's ClientBin directory.
The .xap file can also be found in the silvelright project's Bin
If you're wanting to install the silverlight application to a desktop you'll have to enable the ability to run the application "Out of Browser" and it'll have to be installed. More information on Out of Browser apps...

Build (and Debug) ASP.NET Web Application in a non-default folder location

I have a Visual Studio 2008 solution with an ASP.NET Web Application project. I want to change the default output folder, of said project, to $(SolutionDir)\WebApps\$(ProjectName)\bin. This I can do and when I build I get the expected assembly files in this folder. It doesn't copy the content files (aspx, etc.) to the parent folder but I have managed to fix this by hacking the project.csproj file with a custom build target.
The problem is I want to be able to debug this application using the ASP.NET Development Server, by pressing F5 in VS2008. Unfortunately the ASP.NET Dev server starts, has a "Physical Path", in the project directory rather than the parent of the output directory.
Is there any way to build my web application to a different output folder but still run the asp.net dev server to debug my site?
Thanks.
Short answer is yes, but it isn't pretty. The process I used is given below.
Unloaded the project in VS.
Manually edited the .csproj file to include a post build action that basically copies the content files (aspx, etc.) to the parent of the output folder.
For the debug options I set the project to launch an external executable. The Asp.Net Development server. Also manually set the url to launch.
What I learnt? I wouldn't do this, I'd just stick with the default and create an install/web deployment project instead.

Error in asp.net but application run smoothly

I got a error:
Error 1 Cannot copy assembly 'ICSharpCode.SharpZipLib.dll' to file 'FileLocation\bin\ICSharpCode.SharpZipLib.dll'.
Unable to add 'FileLocation\bin\ICSharpCode.SharpZipLib.dll' to the Web site.
Unable to add file 'bin\ICSharpCode.SharpZipLib.dll'.
The process cannot access the file because it is being used by another process.
Any idea about this?
This is an error you can get when you have a file that's still locked by a process; it sounds like the file was still open by something when you went to build,so it couldn't copy it to the website.
As long as you aren't directly modifying the ICSharpCode.SharpZipLib source code, and since it's reporting it to already be in the location you need, it's possible that the development or IIS server just still had the file open, in which case it wouldn't be a big deal. (Did you close all browsers?) If that's the case, and your application is running fine, then it's probably not a huge deal, although I would probably close down the development server, and Visual Studio, then reopen and try again. (If running on IIS, try restarting the website.)
If you start having issues with whatever part of your code uses the Zip functionality, then you will need to investigate further.
Sounds like your app was recompiling and tried to copy the zip lib, which was already in use because of a bad ref in visual studio or a running program. When does this occur? Please provide more details. Close out visual studio (if its running). If its a web app, restart IIS and try doing whatever unknown action you were doing again.
Application tried to copied ICSharpCode.SharpZipLib.dll file from GAC or Visual Studio Assembly folder into your application's bin folder but it can't copied and application runs successfully on your system because your application put this dll file from GAC. But whenever you will run this application any another system on which Visual Studio not installed, on that machine it couldn't runs properly....

C# debugging issue: No symbols are loaded for any call stack frame

I'm trying to step into a method referenced in an external dll from a C# web service dll. I'm developing the web service code and can step into it from my Winforms app. The dll I'm trying to step into from the web service was developed by someone else, and I have the dll and pdb files. When I try to step into it I'm getting the message below:
'No symbols are loaded for any call stack frame. The source code cannot be displayed'.
Here is my project setup:
.NET 3.5, VS 2008 Professional, IIS 7 running on Vista Ultimate
Winforms app WF1.exe, referencing web service dll WS1.dll, in 1 solution on my machine
Database access dll DA1.dll compiled by another developer, referenced by WS1.dll
DA1.dll and DA1.pdb files located in root directory of WS1 web service project
WS1 web service compiled and published to my local IIS, DA1.dll and DA1.pdb files get copied to the IIS WS1 bin directory
So far so good and everything works to a point. I break and step into WF1.exe then break and step into a method on WS1.dll no problems. However when I try to step into a method on DA1.dll the error occurs. Any help appreciated.
(Also meant to say I attached to the WebDev.WebServer.EXE process to try and step into DA1)
Cheers,
Ciaran
When you are debugging you can load symbols for a dll by going to Debug -> Windows -> Modules
Right click the appropriate dll and Select Load Symbols From -> Symbol Path
If you continue to have trouble with this and just want to see what is going on under the hood, you could open the dll in Reflector.

Categories