Visual Studio 2019 Debugging does not work when VPN is connected - c#

OS: Windows 10 (with current latest updates)
IDE: Visual Studio 2019 v.16.4.4
Visual Studio cannot debug an ASP.NET Core 3 web application when the computer is connect to VPN (via Cisco AnyConnect Secure Mobility Client). The web application is dockerized and is started via docker-compose.
As mentioned here the issue must have been resolved by now; however, at least on my end, it is not resolved yet.
I have tried setting up remote debugging following this, this, this, and this documentation/suggestions. However, neither help debugging my web application when the computer is connected to VPN.
I need to keep the computer connected to VPN because the application requires data that are available via my institute's VPN.

Related

Remote Debugging .Net Core 2.0 on Windows 10 IoT

I've written a Hello World console app in .Net Core 2.0 using VS 2017 and deployed the Debug build to a Raspberry Pi 3 running Windows 10 IoT. I can execute the app remotely via PowerShell and everything seems fine.
Having installed the Visual Studio 2017 Remote Debugging tools, I'm now trying to hook up the Remote Debugger so as I can step through my code on the Pi and I'm running into problems.
When I try to "Attach to process" from the Debug menu in Visual Studio and enter the IP and port number supplied by the IoT device portal I get the following error:
Unable to connect to the Microsoft Visual Studio Remote Debugger named '192.168.1.139:8116'. Connection request was rejected by the remote debugger. Ensure that the remote debugger is running in 'Windows Authentication' mode.
The following screenshot of the IoT Device Portal shows both the IP and Port for Remote Debug and the fact that my app (echo.exe) is running:
I've tried running the remote debugger both with and without the "Run as DefaultAccount" option checked, but this seems to make no difference.
I've also checked the firewall settings on my dev PC to ensure that it is not blocking traffic (I am connecting over the Private network)
Although the error message warns about Windows Authentication Mode, I can find no such setting for the remote debugger. Any help in getting the Remote Debugger attached and operational would be gratefully received.
You may need to select the connection type to "Remote" instead of "Default".
It works for me. You can have a try and feel free let me know if there is any problem.
One thing that I think it could help is when deploying the app to the Remote Machine and you are presented the ‘Remote Connections’ dialog you can choose there what type of authentication you want. One of the options is Windows Authentication. Try deploying and running the app like that and then the Remote Debugger should work.
In your VS Studio Project Properties -> Debug Tab -> Authentication Mode: Window Authentication

Failed to start Asp.net Development Server while Debuging 2.0 Website in VS 2012

I have a 2.0 website (Not web App) which i am trying to debug in VS 2012.
The error i get is
Failed to start Asp.Net Development Server on port : 4599
Error: An attempt was made to access a socket in a way forbidden by its access permissions.
I tried netstat-o and and port 4599 is unused.
Tried opening VS2012 in Admin mode, still no luck.
The app is runing fine when hosted in IIS in the same machine (Win 7). Only it will not run in VS.
Tried another 2.0 website, still same error.
What is causing this ?
Any ideas?
The problem is, this port is bound to a specific host name, therefore starting a socket on the same port as asp.net development server does (any host name) is not allowed
Check your IIS web site bindings
Or Switch to another port on IIS

Remote Debug Windows Forms project

I have simple one Windows Forms project with one Main form in Visual Studio 2013 Update 4, on my dev Windows 8.1 Pro PC. I also have second computer (name: REMOTEPC) with Windows 8.1 Pro and installed Visual Studio Remote Debugging Monitor 2013 Update 4. I have configured Windows Authentication and firewall settings. I have configured project properties for Debug to use remote machine to REMOTEPC:4018 and in logs I see that user REMOTEPC\username connected. I use same local and remote paths (C:\proj\bin\debug\myprogram.exe) and have manually copied all files from directory.
Now I got error:
Error while trying to run project: Unable to start program (C:\proj\bin\debug\myprogram.exe). The MSCSMON.EXE does not appear to be running on the remote computer.
As I understand it needs only one TCP 4018 port and can not find a mistake. I have read MSDN info about this, but can not figure out why its not working. Is the remote debugging for Windows Forms or WPF possible at all ?
The solution is to use to configure firewall / port forwarding if needed, for both TCP 4018 and TCP 4019. I was missing one port (4019) and now it works without a problem.

Hosting an Asp.Net MVC 4 application on windows server 2012 with IIS8 from a Local Machine

I have developed an MVC 4 application on my personal laptop and would like to host it onto a windows 2012 server so that it goes live.
What I am doing right now is, I have published the application as a File System in my laptop and then remote logged in to the windows 2012 Server and trying to deploy it into IIS 8 which is on that server but I could find a way to import my application into the server.
Now, my question is do I need to install Visual Studio 2012 on the server and then copy my application over to it and then publish and deploy or is there any other way.
This is the first time I am deploying and hosting an application. So, I am not sure of the exact procedure to do it.
Remember that my development machine is not the windows server but it is my personal laptop.
Install WebDeploy (a free Microsoft Tool) on your target server. Then you can deploy your site directly from VS. See details here

Visual Studio 2010 - Application not starting up through asp.NET Development Server but works on the Production Server

I am building a .NET 4.0 Web Forms application in C#. After working for around 4-5 months on this application, the other day when I went to 'Start' the application from Visual Studio 2010 and the application does not want to start. When trying to connect using telnet on the local host and that port, it connects, and after a while I get an error '400 - Bad Request'.
The funny thing is that when I Publish the application on another IIS server, it works fine, it seems like the problem is from the asp.NET Development Server. While I know that I can set-up a local IIS, I would prefer not to avoid doing this in order to avoid certain problems which might be related to having a different configuration of the local IIS from production.
I have checked the hosts file, re-installed visual studio and confirmed that the application works when published. I have also checked that the port is not being used by another process.
What else should I check?
If the application will not start, then the odds of you being able to connect to it via telnet on a port are 0. (It's not running.)
I am assuming the application can compile if you can publish it. Have you tried running the application without debugging? CTRL + F5

Categories