Remote Debugger over internet (Remote IP machine) - visual-studio

My setup:
Local PC: x86 vista & visual studio
Client server: x64 server ( static ip ).
Currently I connect with it using Remote desktop. Remote Debugger is running as service and there is a user name with login as service privilege.
Can I configure remote debugger to this setup?
Guides, experiences will make my life little less of a hell. Thanks.

I had a similar problem, and like Hans Passant said above, a VPN is necessary. I was able to attach to the process and debug over the internet by doing the following:
Install the latest microsoft remote debugger on the server.
Install Hamachi on both my local machine and the server and connect so that I was on the same network.
Go to Debug->Attach To Process on my local machine's Visual studios and enter the Hamachi IP address of the server.
Pick "show processes from all users" and pick the process in question.
Note: I was logged in as the exact same user on both machines and had the same password on each.
I hope that helps someone out there.

There's no way to channel your debugger to work over Remote Desktop.
Check out How to: Set Up Remote Debugging, specifically the "Configuring the Windows Firewall" section. You will need make sure you can connect to the correct ports, which will require Software and/or Hardware firewall changes. A VPN could be part of the solution (as #Hans Passant suggested in his comment).
A simpler answer may be to install Visual Studio on a machine within the same network as where you're trying to debug. Then your debugger is making a local connection and you are still interacting with the remote network via Remote Desktop. I'm not sure if this is an option.

For me it just worked over a public ip address. Ensure Visual Studio remote tools will open firewall ports for all relevant networks when installing. Also ensure the connection target public IP address is written with the TCP port (the default for VS2019 is 4024) when listing processes.

No 3rd party apps needed!
(I advise to follow this tutorial, especially the bottom part titled "Set up the remote debugger"). However, to say shortly, after installing Remote Debugging Tools on remote machine, run it with administrator privilegges and then:
Open up Windows Firewall settings page
Click Advanced Settings and there will show up such window:
Click Inbound Rules->New Rule and choose on the following pages:
- [Rule Type] Custom
- [Program] Specific program (and choose : C:\Program Files\Visual Studio\Common7\IDE\Remote Debugger\x64\msvsmon.exe or whatever is your correct path, also note x86/x64 your desired route)
- [Protocol and Ports] Skip that page by clicking Next (or for maximum security, you can actually choose the exact port that Remote Debugger window is showing)
- [Scope] Choose in the second field (where it says Which REMOTE IP..) your current IP address
- [Action] Allow connection
- [Profile] Next
- [Name] whatever slug you want to identify, i.e. My rule for VS
The last step what you might need, is to set the Junction (hardlink) for folder on remote machine to correctly resolve the application files:
* When connecting with Remote-Desktop, share drive from Local Resources > More > Drives > C
* After you connect, on remote "My PC" there will appear your "mapped drive" and copy it's location (i.e. \\RobertoPC\). Then open CMD with admin privilegges and execute:
mklink /D C:\my_folder \\RobertoPC\C\my_folder
On your local PC C: drive create a folder my_folder and put the project into that folder, and run the project with remote debugging option:

Related

Access Postgres running on Mac OS X from Windows 10 (Parallels) dbForge Studio

I am currently developing a Golang app and I am using PostgreSQL. The thing is, I found dbForge Studio for PostgreSQL which I would like to try. However, for some reasons, I am not able to connect to my database, I don't understand why.
I created a "ServerTest" with Postgres.App (on Mac OS), running on localhost:5432. It has 3 database:
emixam23
postgres
template1
From dbForge Studio Express, I tried to open a connection:
Host: 127.0.0.1
Post: 5432
User: root
Password: root
Allow saving password checked
Database:
Connection Name: 127.0.0.1
It fails : Error: 08006: No connection could be made because the target machine actively refused it 127.0.0.1:5432
CONNECTION FAILURE
However, after some researches on internet, it seems that it's a bit different than localhost since it's a virtual machine windows, so I tried from my rooter address:
10.211.55.2
But still, it doesn't work, same error. Do you have any idea why?
Thanks for any help !
Max
I imagine that the answer is coming to late for you here, but hopefully this will be accepted as the answer to assist people in the future.
Paths could change based on installation method, this assumes Postgress.app
Default path here will be referred to as path, for ease o: /Users/[username]/Library/Application Support/Postgress/var-[version]
Setup a PGDATA environment variable pointed to the path of the application, you can set this up in your shell profile script, but we will just run this from the command line. Replace [username] with your OSX username and the with your version. As of this writing that would be 11:
export PGDATA="/Users/[username]/Library/Application Support/Postgres/var-[version]
example, user LimpingNinja, version 11:
export PGDATA="/Users/LimpingNinja/Library/Application Support/Postgres/var-11
Modify $PGDATA/postgresql.conf and add the following to the end of the file and save it (if you already have this defined, modify it as needed):
listen_addresses = '*'
On your Parallels virtual machine open up a CMD Prompt and type 'ipconfig'. This will output some data, you should look for the line that says "Default Gateway" it may have an ipv6 address (which may appear as gibberish) but the address you are looking at looks like below:
Default Gateway . . . . . . . . . : 10.211.55.1
Modify $PGDATA/pg_hba.conf and add the following line, replace the 10.211.55.1 with whatever you had in Step 3. I used a /32 at the end of mine (just in case the address changes) but you could likely use a /4 or /8 if you wanted to constrain this more:
host all all 10.211.55.1/32 md5
Open up Parallels and go to Menu Preferences -> Network and make sure you are in 'Shared' in the left pane. On the right pane check the box for "Show in System Preferences". You may have to click the Lock Icon if this is grayed out. Close when done.
Open System Preferences -> Network and click on Parallels Shared Network (or similar) and note down the IP Address, default is usually 10.211.55.2
Inside of your Parallels Windows VM, edit the hosts file which appears at C:\Windows\System32\drivers\etc\hosts and add the line below, replacing the IP address (10.211.55.2) with whatever you had from Step 6. Note: You might not be able to save directly here, so copy that file to somewhere you have access, edit it, and then copy it back overwriting the original for ease
10.211.55.2 vmhost
In OS X, restart Postgres. When using Postgres.app simply open it up and click [Stop] followed by [Start]
Within your Parallels Windows VM you should now be able to connect to vmhost:5432 with PGAdmin, Connection String, or whatever.
This was sourhttps://gist.github.com/justingarrick/11180527
It looks like connectivity configuration problem.
Try to connect with native tools e.g pgAdmin. In case of successful connection it proves dbForge problem. Otherwise try to find an answer in Pg configuration, or in network availability of your virtual machine.

VS2015 Unable to connect remote debugger

I have VS2015 locally. Windows 2012 R2 server hosting an IIS8 test website.
I've put the updated DLL and PDB files in the BIN of the test website.
Step 1) On the remote server, I make sure the Remote Debugger is started.
Step 2) While in VS, I navigate to Debug => Attach to Process. Click "Find". Then click "Select"
This is when the error shows up "Unable to connect to 'address'. An operation is not legal in the current state."
I noticed the Qualifier port was changed, and is different than what shows in Step 1... so I try manually changing what's in the Qualifier to match.. but same issue.
I see the "Transport" is changed from Remote to WebKit. Not sure if this is a problem...
I figured it out. Instead of choosing Remote in the Transport dropdown. Select Default and then put your server in the textbox. Even though I am doing remote debugging, it solved the problem.
I got the same error while I tried to attached my solution with running localhost application hosted in iis. I just fixed it by selecting "Native code" in the "Attach to" field of the "Attach to Process" dialog.
In my scenario, a process running on a machine behind firewall had to be debugged. Usual steps did not help in discovering the machine or its process by selecting the Remote (No Authentication) option.
The following steps helped in remote debugging the process with firewalls on:
Run Remote Debugger on remote machine. The remote machine may have the firewall on. Leave Remote Debugger to run with Authentication Mode as Windows Authentication.
On the debugging machine, go to Debug->Attach to Process, and leave Default in Transport drop-down. Enter the IP of the remote machine for Qualifier and press Enter. This will ask to provide credentials to log into remote machine. Provide credentials. Processes running on the remote machine should now be listed under Available Processes
If the intended process on remote machine is not listed in Available Processes, check ""Show processes from all users"". This should show the process intended to be debugged.
If the break points are not loaded or hit when expected, go to Tools->Options->Debugging-> Uncheck Enable Just My Code. Break points should now hit.
Hope this helps.
Can a moderator add tags remote debugging and remote debugging with firewall to this post, and remove this line?

Are there any alternatives to hosts file for accessing virtual hosts from multiple PCs?

I have several virtual hosts set up on my PC running WAMP. All the other PCs in the office need to be able to access these too. Traditionally, every time I added a new virtual host to my PC, I need to go to all of the other office PCs and modify their hosts files. This works fine, but it is a pain to go edit all of these files.
Is there an alternative to this? Is there some way of having a centralised hosts file on the network or some other solution?
Some routers have the ability to map domain records into IP adresses and act like a DNS. But if your router dont support this:
Try Acrylic DNS Proxy. Acrylic is a free and open source local DNS proxy. Follow the installation instructions on the website to set it up. Basicly you will need to install this program only on your main PC that will act like a "DNS proxy". Then you will need to set your other computers primary DNS server to hook with your main pc.
Step 1: Install
Launch the Acrylic.exe file and click on the Next button.
Read and (if you like it) accept the license agreement by clicking on the I Agree button.
Choose the installation folder (the default is the Program Files\Acrylic DNS Proxy folder) and click on the Install button.
Step 2: Configure
Do the following steps only on your main PC
Click on Start Menu -> Programs -> Acrylic DNS Proxy -> Config -> Edit Configuration File
Find the text "; ALLOWING REQUESTS FROM OTHER COMPUTERS" and configure it properly. Its well commented and very easy.
Click on Start Menu -> Programs -> Acrylic DNS Proxy -> Config -> Edit Custom Hosts File
Edit the host file as you want. You can use Wildcards like "192.168.0.2 *.local" or regular expressions. So all the domains ending with ".local" will be pointed to your main server.
Note: After changing the configuration files you must restart the Acrylic DNS Proxy service from the start menu.
Step 3: Hook to the DNS Proxy
In order to use Acrylic you have to tell your computer that the DNS servers to be contacted for name resolution is no more your ISP's but Acrylic. There are ways to do it depending on the version of the OS you are running:
Windows 2000
Windows XP or Windows Server 2003
Windows Vista or Windows 7 or Windows Server 2008
Note: On your other computers you will have to replace the "127.0.0.1" to your main PC network address. For example "192.168.0.2" . And leave the secondary DNS to 8.8.8.8 (Google DNS) so the other computers can browse the internet even when your main PC is not connectable (or turned off). Like this
Step 4: Test
Make sure everything is properly configured and your main PC is connectable and running. If you have antivirus or firewall programs they will block this DNS proxy so make sure you configure them properly or disable them at first just to test everything is working. Also your main PC local IP address must be static.

Getting Visual Studio debugging to work when running in Parallels

I've got a Windows 7 machine set up on Paralells.
Everything is working fine. Can access internet from IE or other browsers on my Parallels.
However, when trying to debug a web application in Visual Studio 2010 (by pressing F5 for example) then my default browser in OSX launches, which is great, with localhost:4243 (or whatever port Cassini has allocated on my vm)
Naturally, this doesn't find anything...
What do I need to do to either my parallels vm, or the settings on OSX to get debugging working? ie- my mac talking to the vm?
Make sure you are on the same network.
Use IIS.
Like so:
Your Win-machine has a name, let's say it's called "myWin7machine". Change "localhost:4243" to "myWin7machine:4243" in the browser.
If this doesn't work (well... it shouldn't) you might have the firewall on or the network not bridged. Let's start with the bridging.
Time to check some basics - be on the same network
Check your IP address. It's "ipconfig" on the Win machine and "ifconfig" on the mac; both run from the command prompt. The IP address should be something like 10.4.... or 192.168... on both. The important thing is that only the last number is different. (this is technically not correct but works for 99% of the cases) If they are equal (except the last) you are bridged - which means both machines are on the same network. If they differ too much you had running the Win machine's network "inside" the Mac's. Go to the settings for Parallels (in windows: move your mouse to the top to show Parallel's menu and go to Devices->Network and something "(bridged)". Wait until the balloons disappear and check ipconfig again.
Check that you can ping the Win machine from the Mac. Ping functionality might be turned off in the Win machine but probably isn't.
Now we know we are on the same network.
Still doesn't work
Can you do http://myWin7machine:4243 from the mac? Well.. you shouldn't be able to.
Can you do it from the Win machine? You should.
IIRC Cassini doesn't talk to strangers. I.e. it doesn't talk to anything but localhost.
If I am wrong - just open port 4243 in the firewall on the win machine and you should be good to go.
But otherwise...
Time to change web server.
Install IIS on the win machine.
In the Mac: surf to http://myWin7machine and see the IIS7 logo show.
If you don't you have a firewall issue. Open port 80. Try again.
If you have come this far then you can surf from the Mac to the IIS on the Win machine.
Time to set up your VS solution
Open the IIS admin GUI. Create a new Site. Let's say you call it MyTestSite. (you can always rename it later) Point it to your VS solution's web. Typically the same folder as web.config resides in. On the win machine: try surfing to "http://localhost/MyTestSite". Your site should show up. You might get an Apppool error.
Now try http://myWin7machine/MyTestSite on the Mac. It should work.
ROCK!
Time to set up debugging in VS
For debugging in IIS you have to connect to the process. In Win7 it requires elevated privileges so either you restart VS as admin or you try to connect and VS will do it for you.
The menu in VS is Debug->Attach to process and you choose w3wp.exe.
This is how you debug faster anyway - by connecting. Restarting your web for every debugging session is a waste of time.
To make connecting faster - use ctrl-alt-p and the continue with using the keyboard.
To make connecting even faster use a macro.
There is more info in these 4 articles: http://www.selfelected.com/tag/iis/
Set a breakpoint. Refresh your browser and the breakpoint should be hit.
Time to hack some code
Good luck!
I'm using Windows 10, VS 2015, Parallels 11 on iMac with OS X El Capitan (10.11.5). The following are the steps that worked for me:
On Windows side:
Get the IP (run ipconfig command in command window)
Get the host name (run hostname command in command window)
In control panel look for Windows Firewall -> Advanced Settings and add a new inbound rule and a new outbound rule. For both make sure you select Port, Allow Connection, TCP and specific IPs. I added a range of IPs 45000 - 45999 but you can select the range you like.
In Visual Studio:
Look for project properties and under web section change Server settings to look something like this.
Instead of "winmac" you will use the host name found in "Windows Side - Step 2". The port can be any number inside the range you setup for your firewall rules.
On Mac OS side:
Update /etc/hosts file. At the end of the file add the IP and host name that we found on steps 1 and 2 of the "Windows side" section. When you finish this step the file should like something similar to this.
Ready to debug:
Now you can start debugging in your Mac from Visual Studio. Make sure that before start the debugging process you select "Open In Mac" option (instead of Chrome or IE in your debugging options in visual studio).

Remote WMI with Windows XP SP3

A fresh Windows XP SP3 install does not allow remote WMI access like Windows XP SP2 does.
If I follow the steps in the "How to troubleshoot WMI-related issues in Windows XP SP2" document at http://support.microsoft.com/kb/875605 I'm unable to get SP3 to respond to a remote WMI request.
Every request, even to the built-in Administrator account, a new account in the Administrators group, or even a new account not in the Administrators group but given access to remote DCOM & the WMI namespace as described in the Microsoft document all return error code 0x80070005, Access is denied.
To verify I didn't have a goofy system configuration, I installed a fresh Windows XP SP3 image (using the .ISO image from MSDN) and performed no configuration changes save enabling RemoteAdmin through the Firewall. The Access is denied behavior was seen in this scenario as well.
What changed in Windows XP SP3 to remote DCOM / WMI access and how best to enable it?
It turns out the issue wasn't specific to SP3, but rather the lack of these systems being in a domain.
If XP isn't in a domain then the "Use Simple File Sharing" option, found in the Folder Options control panel applet, works it magic. If this option is enabled (the default) all file sharing connections are done with the guest user credential, but this also is applied to incoming DCOM connections as well.
Disabling this option allows DCOM connections to be verified as expected.
Supposedly SP3 does not check 'Enable Distributed COM on this computer'. Get into Component Services (dcomcnfg.exe) Component Services, Computers. Right click 'My Computer' and go to properties. 'Default Properties' is the tab you want. I have also heard that changing the DTC Logon account to NT AUTHORITY\NetwerkService (note the e instead of an o) will work. You can find this under the MSDTC tab, Security Configuration following the same path to My Computer.
We solved something very similar by using these tricks. Hope this helps.
I'm not sure if RemoteAdmin is the one you need to turn off or not in the firewall.
One suggestion would be to turn off the firewall completely first and try that. If it works, then you know it is the firewall. If this is the case, then I would try adding port tcp 135 directly and try again.
You may also try using telnet [ip address of XP_SP3 machine] 135 and see if you can establish the connection.
Hope this helps.

Resources