Remote Debugging ASP.NET VSCode - asp.net

I have an ASP.NET/IIS site setup using vagrant. Is there a way to remote debug from VSCode on my local machine? Having a difficult time find info on this
I see remote debugging but it sounds like it's only for visual studio
https://learn.microsoft.com/en-us/visualstudio/debugger/remote-debugging-aspnet-on-a-remote-iis-7-5-computer?view=vs-2017

According to the documentation remote debugging is not part of VS Code:
VS Code does not support 'remote debugging' by itself. Remote debugging is a feature of the debug extension you are using and you should consult the extension's page in the Marketplace for support and details.

Related

Unable to attach Debugger from VS 2017 to Azure app service for ASP.NET CORE 2.2.1 app

I am new to azure, I have hosted a asp.net core web api in Azure App services. I am able to browse the azure link. However I am getting some internal error while accessing the service.
To find out the error I want to debug the application by attaching to visual studio. But while attaching the debugger I am getting below error as shown in the image.
ERROR POPUP WHILE ATTACHING DEBUGGER
Error: "Unable to find a process called dotnet with arguments .\APICore.dll. The process may still be starting, please try again."
APICore is my Web api project.
I have verified that REMOTE Debugging is enabled.
Application is ASP.NET Core.
Visual Studio is VS 2017 community
edition.
I've had the same problem today, and this is what worked out for me:
1) Instead of attaching the debugger via Server Explorer, go to Debug > Attach to Process...
2) Set the Connection Target to your App Service url without http and with port 4022.
So, http://myappservice.azurewebsites.net would become myappservice.azurewebsites.net:4022
3) Hit the Refresh button. You will be prompted for credentials to access your App Service. Those can be found on the MSDeploy publish profile of your publish profile file:
<publishData>
<publishProfile profileName="myappservice - Web Deploy" publishMethod="MSDeploy"
publishUrl="myappservice.azurewebsites.net:443"
userName="{USERNAME}" userPWD="{PASSWORD}" ...>
<databases />
</publishProfile>
<publishProfile profileName="myappservice - FTP" publishMethod="FTP" ...>
<databases />
</publishProfile>
</publishData>
4) After the available process show up, select w3wp.exe and hit Attach
Had the exact same issue, tried several things (open in Admin mode, open outbound port 4022, 'Attach debugger', 'Attach to process') but nothing worked.
Just switched from VS 2017 Community edition to Visual Studio 2019 - Enterprise edition and now it instantly works flawless:
Published my Azure App Service in Debug configuration
Attach debugger via the Cloud Explorer
Set the breakpoints and hit them when sending requests to the API
So perhaps switching to 2019 will solve it for you as well.
There are few options that you can try out and see if that helps.
Ensure Visual Studio is opened in Administrator Mode and follow the
same steps.
Open the Outbound ports 4022 for VS 2017 on corporate firewall.
You can also go through the below links in order to Remote debug the
application
https://learn.microsoft.com/en-us/visualstudio/debugger/remote-debugging-azure?view=vs-2017#remote_debug_azure_app_service
The answer above using a regular
"Attach to Process" using creds from a publish profile downloaded from the portal worked for me.
VS2019 (community and professional, multiple azure accounts, multiple machines, physical and virtual) here, and the cloud explorer "AttachDebugger" never worked. In fact it hung vstudio at "attaching to process" and had to kill VStudio from task manager to stop it.
Strange because at other companies/projects I didn't have this problem. For years I relied on debugging azure from desktop for a variety of projects. This particular software I inherited, and I expect that something in its origination or construction (there are several ..."sub optimal"... aspects to it).

Debugging a production asp.net application locally

I made an asp.net application on my development box which was deployed on production.
I can see my application on production URL with public domain such as https://www.myapp.com ( sample).
Is it possible to debug the application by attaching the process using from my Visual studio development environment by following - Go to debug and then attach the process by selecting the browser displaying https://www.myapp.com ?
I tried it and its attaching the process but it does not hit the debug points in VS2010 . Can anyone please let me know if its possible to do this way ?
Thanks in Advance! Junni
It sounds like you are just debugging your browser. If you want to debug a remote machine you need a debug version of your code running on that machine and MSVSMON.EXE running on the remote machine. You would be best servered by reading http://msdn.microsoft.com/en-us/library/bt727f1t.aspx
then researching MSVSMON questions here.

ASP.Net local debug on a Windows Server 2008 R2 Terminal Services Server

We have a Windows Server 2008 R2 box setup as a Terminal Server with Visual Studio 2012 installed on it for remote developers to be able to do development on our ASP.net systems.
We would like to be able to do debugging on out projects the same way we do when developing on our local machines using visual studios internal development server.
I am trying to start local debugging on an ASP.Net project (F5) in VS2012 - the project compiles - IE comes up with my localhost url and then it just spins with "connecting..." and the page never comes up.
Pulling up the same workspace on a local machine and debugging comes up just fine.
I've exhausted my google-fu on looking for solutions here and humbly ask you all for any insight.
Visual Studio works a little differently when you are debugging on a server. You don't really want to use VStudio to play/debug on a web server. You need to use the menu option "Debug", "Attach to process". There will be several processes running, so it might take a few tries to find the right process.
Be careful though. Because your break-points will actually freeze IIS for the entire server. It could be a pretty big inconvenience for everyone who is using IIS at the time.
If you are trying to debug the project from your IIS server, you need to verify if the account has Administrator rights, also if the project has been deployed with its source files, you can attach the process (maybe it is w3wp.exe) in Visual Studio and debug it.
Another way is to open the solution using Visual Studio and change in the web project's property the server: Use Visual Studio Development Server.
Let me know more info about your scenario to provide you more paths.
What I would do is attach to the IIS process on the server: http://msdn.microsoft.com/en-us/library/vstudio/3s68z0b3.aspx you can even do this off your machine.
make sure debug is enabled in web.config for that app and you've mounted the remote project. Add a break point, debug by attaching to the IIS app pool process & it'll trigger the break point.
I was able to Attach Process to the SPUCWorkerProcess.exe even though it's a farm solution and not a sandbox solution

remote debugging problem in Visual Studio

I have local my projects asp.net open in visual studio 2010. And also copy this project to IIS folder in remote hosting. Cause in hosting directory I don't have VS so I copy there remote debugger application. I connect from my Visual Studio to IIS process on hosting, but any of breakpoints not fire.
Why ?
I had the same issue when I connected using the Transport in the "Attach to Process" dialog set to "Remote (native only with no authentication)". I was able to connect to the IIS process (w3wp.exe for IIS6 on Win2K3), but no breakpoints were hit when I navigated within the web app.
To get it working, I changed the Transport to "Default". Then I ran into numerous issues with successfully connecting to the Visual Studio Remote Debugging Monitor. But once I resolved them all and was able to get the list of processes from the remote machine, I could connect to W3WP.exe and voila, my breakpoints started working and I was able to debug normally.
You don't provide much detail on your local and remote configuration, so this just a guess whether it might help.

Remote Debugging Server Side of a Web Application with Visual Studio 2008

So, I've read that it is not a good idea to install VS2008 on my test server machine as it changes the run time environment too much. I've never attempted remote debugging with Visual Studio before, so what is the "best" way to get line by line remote debugging of server side web app code. I'd like to be able to set a breakpoint, attach, and start stepping line by line to verify code flow and, you know, debug and stuff :).
I'm sure most of the answers will pertain to ASP.NET code, and I'm interested in that, but my current code base is actually Classic ASP and ISAPI Extensions, so I care about that a little more.
Also, my test server is running in VMWare, I've noticed in the latest VMWare install it mentioning something about debugging support, but I'm unfamiliar with what that means...anyone using it, what does it do for you?
First, this is MUCH easier if both the server and your workstation are on the same domain (the server needs access to connect to your machine). In your C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\Remote Debugger\x86 (or x64, or ia64) directory are the files you need to copy to your server. There are different versions between Visual Studio versions, so make sure they match on the client and server side. On the server, fire up msvsmon. It will say something like "Msvsmon started a new server named xxx#yyyy". This is the name you'll use in Visual Studio to connect to this server. You can go into Tools > Options to set the server name and to set the authentication mode (hopefully Windows Authentication) - BTW No Authentication doesn't work for managed code.
On the client side, open up Visual Studio and load the solution you're going to debug. Then go to Debug > Attach to Process. In the "Qualifier" field enter the name of the server as you saw it appear earlier. Click on the Select button and select the type of code you want to debug, then hit OK. Hopefully you'll see a list of the processes on the server that you can attach to (you should also see on the server that the debugging monitor just said you connected). Find the process to attach to (start up the app if necessary). If it's an ASP.NET website, you'd select w3wp.exe, then hit Attach. Set your breakpoints and hopefully you're now remotely debugging the code.
AFAIK - the VMWare option lets you start up code inside of a VM but debug it from your workstation.
Visual Studio comes with a remote debugger that you can run as an exe on your server. It works best if you can run it as the same domain user as your copy of visual studio. You can then do an attach to process from the debugger on your machine to the IIS process on the server and debug as if it was running on your machine. You get more options for .Net debugging, but there's support for older platforms too.

Resources