I'm currently developing a WPF-Program which is running on an external server.
I now have installed the Remote Debugger both on the server and on my notebook.
For my tests, I don't install this program, just to save time .. but is there a chance, to Debug the *.exe file which is copied to the server?
Thanks in advance!
Go to Debug->Attach to process in VS menu.In the opened dialog inside Connection target box find your remote server through IP or hostname. It will show the exe running on server (if you have run VS remote debugger MSVSMON.EXE running on server machine) .Click on attach button and then you can debug the exe.
Related
I have a particular setup which is giving me trouble in getting remote debugging to work.
ASP.Net Core 2.2 targeting full .NET framwork 4.7.2
Running under IIS 8.5, Out-of-Process
I am trying to remote debug in Visual Studio 2017. I can connect to the remote debugger, see the processes etc. There is no dotnet.exe running, just w3wp.exe and under that, the application X.exe
I can connect to the w3wp.exe but any breakpoints say they won't be hit as symbols are not loaded. I built/deployed with Debug and there is an X.pdb in the same location as X.exe both locally and remotely.
Debug->Windows->Modules is not much use to load symbols as all that is listed there are the standard .dlls which w3wp.exe loads. The app is an .exe, not a .dll module and so is not in the list and so I cannot load symbols manually.
I have tried connecting to X.exe directly but it just says it can't connect and to make sure the remote debugger is running (which it is, since I can connect easily to the w3wp.exe process).
I have tried coping everything (including the .exe and .pdb) to the same path on the remote (that is set in the debugging options). I have also tried running the remote debugger as the same user as the one running the local VS. Always the same result.
Any ideas appreciated.
As far as I know, we could attach the w3wp.exe to remote debug the IIS asp.net core application. Make sure you attch the right worker process.
Besides, I suggest you could try to follow below settings to set the symbols in your visual studio 2017.
I suggest you could copy your local project’s bin folder path and add it into the symbol file. locations as below:
Example: C:\Users\usernmae\source\repos\TestCore\bin\Debug\
Details about how to remote debug the application, I suggest you could refer to this article.
I have one test machine that my program needs to run on that machine. It fails to run but I don't know the reason.
I want to debug the code on that machine to check the issue without installing Visual Studio 2012 on that machine. I have the source code of the program. What should I do?
Thanks.
You will need to use the remote debugging tools, go to your start menu, find your visual studio and expand it, find Visual Studio Tools and then remote debugging folder.
When you have this copy the x86 or x64 folder over to the machine you want to debug on and run the application or web page and msvsmon.exe.
Then on your machine from the debugging menu attach to process, and then target the machine that you want to run against.
Then look for the process you want to debug
You can use remote debugging and debug the remote code on your machine as you have the source code. You can also write exception logs in remote application to know what error has occurred at what place in your code. For remote debugging the see the detailed explanation about remote debugging as under from MSDN article.
How to: Enable Remote Debugging
Visual Studio provides support for remote debugging, that is, the ability to debug an .exe on another computer connected to your network. The Use remote machine property on the Debug page of the Project Designer enables remote debugging of an .exe. When this option is selected, you must specify the name of the machine on which the .exe will run. The location of the .exe on the remote machine must match the value of the Make exe path property, which is on the Compile page of the Project Designer.
In order to debug on a remote machine, the following conditions must be met:
The remote machine must have debugger components installed.
The user of the local machine needs to be in the Debugger Users group on the remote machine.
The .exe must be in a shareable directory on the remote machine.
For more information, see Remote Debugging Setup.
To enable remote debugging
Make sure that the remote machine is properly configured for remote 2. debugging. For more information, see Remote Debugging Setup.
With a project selected in Solution Explorer, on the Project menu click Properties.
Click the Debug tab.
Select the Use remote machine check box.
In the Use remote machine field, enter the name of the remote machine, using the format \domain\machinename.
I would check remote debugging. You can find information about here.
Everything works if I do "Attach To Process".
But I need to debug a problem during launch of an application, so I need to be able to either "Start project" or "Start external program" the remote exe.
When I do, I get "directory does not exist". (Presumably, It is either looking for this non-existent directory LOCALLY, or it lacks permissions.)
Details:
* .Net Framework 3.5; C# Windows Form, with button that when clicked does
Debug.WriteLine("Hello World!");
Two Windows 7 Ultimate PCs, with same username and password, administrator.
Local PC:
Visual Studio 2010 Professional. Hello World project open and built.
Tested locally: Start Debugging / hit button / see "Hello World!" in VS Output pane.
Quit local version of app.
Remote PC:
Visual "Microsoft Visual C++ 2010 SP1 Redistributable" installed (so can run a debug version of this .Net application; before installing said "The program can't start because MSVCR100.dll is missing, when hit a breakpoint.").
Visual Studio Remote Debugging Monitor running.
says "(date/time) Msvsmon started a new server named Steve#FRESHINSTALL: Waiting for new connections".
When Attach to Process, says "FreshInstall\Steve connected".
Copy from local pc's project location (in default VS 2010 projects), \bin\debug* to C:\Code\HelloWorld*
Code folder is Shared with full privileges (just in case ...)
Attach to Process works fine:
click button => "Hello World" -- in Local PC's Output pane, just like when running locally.
Now, the problem. How LAUNCH the .exe remotely, instead of Attach to Process?
On Debug pane:
Tried "Start project"
alternatively, tried "Start external program:" C:\Code\HelloWorld\HelloWorld.exe" -- on Remote PC, this is the path to .exe
Working directory: "C:\Code\HelloWorld" <-- this directory ONLY exists on Remote PC (deliberately -- to make sure we aren't executing locally)
[checkmark] Use remote machine: FRESHINSTALL.
Tried with and without "Enable the Visual Studio hosting process".
When do "Start Debugging", all variations say "The working directory does not exist: "C:\Code\HelloWorld".
Well, of course not: it is on Remote PC, not locally.
Yet everywhere I look, this is what instructions say to do.
What am I supposed to do differently, or what could be wrong?
(Obviously this simple app, I could stick with Attach To Process. But I have a MUCH more complicated multiple-dll application, which is having a problem during startup. I need to breakpoint the "real" application during its start up, not after it is already running.)
(And the real situation I have to debug, is on the other side of the world, with a slow internet link. This is a local simulation of what is going wrong there. Not practical to install visual studio on the actual remote PC, to turn it into a local debugging situation. Spent a day trying to remote debug that; after I get it working on a local network, I have to duplicate the whole process with much less control over what is going on.)
In the interests of closing this question, to indicate that it has been addressed:
See wal's first comment on my question, and follow the link he gave, which I repeat here:
Visual Studio remote upload and debugging on other computer
I am trying attach process on other PC to debug remote. But Type of code in the "Attach to process" dialog is always Native (x86 or x64) and never Managed code (my App is 100% managed). And after attaching I can't debug managed code. Why is that happens?
Now I have to change my question. The problem was in Remote transport mode(only native code support). But now I cant start working.
I made user with my login name and password on other PC with admin rights
I have run remote debugger from that user
After i chose Brows to that PC( server name from remote debugger), debugger says:
Unable to connect to server. The requested name is valid, but no data or the requested type was found.
On the remote computer look for in the Visual Studio Remote Debugging Monitor for something like Msvsmon started a new server named 'user#servername'...
Now, on the computer running Visual Studio enter the same server name in the Qualifier text field in the Attach to Process window. Unless you're on a 'safe network', leave the Transport at Default.
You should now be able to see your application under Available Processes.
While creating the website I choose Location as HTTP and then provided http://172.24.17.188/myProject and it created the project happily.
And I was able to run the project too. But once I have closes the VS2008 and reopened the project , I am getting the following error while trying to run the website.
Edit:
I am able to browse the website by manually typing in browser but unable to run or debug usinh VS2008.
If the website is running on IIS on the same machine then you can attach the debugger to the IIS process. You do this by click on "Debug" then "Attach to process...". Sort the processes in descending order and find the process named "w3wp.exe". Then click the "Attach" button. If you don't see the process then view the site in a browser to allow IIS to start the process.
If the website is running on a different server then you can do the same but you need to run the remote debugging tool (MSVSMON). This means you will need to have Visual Studio installed on the webserver. Run MSVSMON and be sure the firewall doesn't block the connection. Now you click "Debug" then "Attach to process...". Enter the server name that was displaed on MSMON's debug window in the qualifier textbox. If everything is setup properly you will see the remote servers process list. Then you can connect to the "w3wp.exe" process.
These are two ways to debug web applications using Visual Studios and IIS.
Do the following changes in your IIS settings
Make sure that IIS is configured to use Integrated Windows Authentication
Make sure that HTTP Keep Alives are enabled.