Difficulty getting Visual Studio 2010 to attach to remote processes - c#

It's been years since I've had such a hard time getting something to work. I'm at home, on subnet 192.168.50.nnn. I VPN'd in to XYZ company office machines that are on subnet 192.168.40.nnn, domain XYZ. I can ping the remote machines, I can net map their drives and copy files back and forth, but for the life of me I cannot remotely debug a C# program running on a machine called R (ipaddr 192.168.40.100, Windows Server 2003, IIS-6) from Visual Studio 2010 on my laptop (ipaddr 192.168.50.10, Windows 7, user XYZ\username, machine name L). I've read every MSDN article I can find, I've checked firewall settings, I unblocked port 135, I have the same user name and password on the two machines, I've tried running msvsmon.exe on R as a service and as an application (advertising itself as username#R), msvsmon has sufficient privileges, but I just cannot attach to any process on R. I can't even get a list of processes on R to show up. If I could pay someone to fix the problem I would, but I wouldn't pay a dime until I saw it working.
[Note: The IP addresses above are illustrative only, not the real values.]

I had a similar problem and my setup looked like this:
Client: Windows 7 x64 on a private subnet 192.168.1.x. Running Visual Studio 2010
Server: Windows 2008 R2 Standard SP1 with a public IP-address
Both client and server where stand alone. I.e. no domains, just workgroups.
VPN connection from client to the server and when I connected the client got the ip 192.168.0.131 and the server 192.168.0.130.
Turned off all firewalls etc. for the VPN connection, created identical users on the client and the server and identical password.
Ping, network shares, etc. working with no problems over the VPN connection. But I got the same error message from Visual Studio: "The Visual Studio Remote Debugger on the target computer cannot connect back to this computer. A firewall may be preventing communication via DCOM to the local computer."
The solution for me was to change the workgroup name on the client to the same one as the server.
After that, everything worked perfectly.

You need to be authenticate on the same domain (or at least there be a trust relationship between the two) as the remote machine. Is the local machine attached to the domain on the other side of the VPN? If not, you cannot debug managed code using remote debugging.

Related

Run C# application without SQL Server Management Studio installed on client machine

I have created a simple login application using the C#.net. I have some basic sql database(I use SSMS). There is name, email and password. I want my application to be usable from more devices (so I can't use localdb). Everything works fine on my pc but when I move to another, where is not installed ssms it shows error 26 - Error Locating Server/Instance Specified. I don't know how exactly to run my C# application without SQL Server Management Studio installed on client machine
I have researched for a weeks so I enable tcp/ip (from sql server manager), also add new inbound rules for tcp(1433) and udp(1434) ports in windows firewall. After that I allow remote connection and add sql server in windows firewall. Also I've tried to install SSMS on client machine but nothing
here are my conncetion strings
this one I tried to solve my problem
Data Source=xxxxxxxxxxxx;Initial Catalog=xxxxxxxxxxx;Integrated Security=SSPI
the other one is my main connection string
Data Source=xxxxxxxxxxxxxxxxxxxxxxx;Initial Catalog=xxxxxxxxxxxxxx;Integrated
Integrated Security = True
The application works fine on my computer, I've installed Visual Studio 2017 and SQL Server Management studio, but when I move to another computer it doesn't work.
Thanks to everyone in advance!!
SSMS is just a Database Management Tool, the actual Database would by SQLExpress or similar. So on your remote host you need to install the latter and set it up correctly in you application to use to appropiate connectionstring to it.
Schema compare your tables from VS and your ready to go.
https://www.microsoft.com/en-us/sql-server/sql-server-editions-express
https://www.mssqltips.com/sqlservertip/5528/installing-sql-server-2017-express/
You dont need to install sql or sql managemment studio in pc where you running your application, but just as your error said "Error Locating Server/Instance Specified", the server where you want to connect, is not accesible, thats means you should open your ports in pc where your sql server is hosted, and also, put your public ip following with that port in your server name in conectionstring, like Data Source=yourserver_IP:8076; tip: make sure your app pc and server pc are in same network.
The reason it works on the same machine is most likely is is that when you go through another machine the connection has to go through a firewall that is blocking access to SQL Server. The default port that SQL Server uses is 1433 and unless you change it on the host machine when you connect from another machine that is the port that is use to connect and you don't have to specify the port. When you connect on the same machine that SQL Server is installed the firewall does not prevent you from connecting. Port 1433 is used for the default instance (The first installed instance on the machine).

Loopback 127.0.0.1 not working in win 7

I am trying to communicate with comms from a server to a client on the same PC. So if I send the word "Hello" from one it appears on the other like a chat program. As I am on one PC I set IP to 127.0.0.1 and port to 7000 although port could be lots of other numbers. When I press to connect it will not connect to local host.
On XP laptop all is OK so something in set-up is not good. I looked at opening Firefox and typed in Local Host it works, tried 127.0.0.1 it works so IIS is working BUT that is not what I want. I looked for files with local host in and find in C:\Windows\System32\drivers\etc a file called hosts with 127.0.0.1 and IPv6 version ::1 commented out. Uncommented and still nothing works.
Switched off firewall still no good, switched off Virus detection still nothing.
What have I missed how can a chat program talk on loopback in Win7?
I'm not sure if you are intentionally typing in Local Host separately. The host "localhost" is what you are after, followed by the appropriate port number.
Example:
http://localhost:7000/url_to_chat
If you have been doing that correctly, then you just need to define two different ports for each app if you are running both on the same machine in Windows 7 and done.
If you are using Visual Studio's IIS Express (recommended as you don't have to run as an admin), all you have to do is specify the port number and create the folder. You'll then have to run each app.
Hope that helps.
Try this site for information on how to change your hosts file:
https://bowerwebsolutions.com/how-to-edit-your-local-host-file-for-testing-web-sites/

Windows service does not work outside office environment

I have developed my own Windows service on my work laptop. It is installed on tcp on local host on the port 555. The service can be easily started and stopped from the office whether I am connected via LAN or Wifi.
Once the service is installed it will look for some jobs it has to do from an Sqlite database which, as you know, works without a connection and does not require a server.
As soon as I take my laptop home the service becomes unavailable. My program generates a SocketException that says
No such host is known
And the service is unable to start.
So I spent half a working day to check my program for errors. Eventually I came back to the office to see the service is back to work without me having changed a thing. To make sure, I took my laptop to a coffee shop nearby and tested using their Wifi. It did not work there either.
I checked my IP on What Is My IP? for any proxies but there are no proxies detected. But the mother company of my office that is giving us the internet resides in another city and What Is My IP also thinks that I am in that city. So I am currently only able to develop and test my service in the office environment. But that of course is a very bad thing since this Windows service should soon be installed on our customer servers. Any clues?

Remote Debug with Amazon Web Services (EC2) and c# Windows Service/WCF

I have a Windows Server 2008 R2 in the Amazon EC2 cloud. I would love to be able to debug my C# Windows Service or WCF Service that is running on that server from my desktop in my office.
In the past we got around it by installing Visual Studio on the server in the cloud, but we use remote debugging for our local servers, so I was hoping there was a way to make it work in the cloud.
Has anyone out there accomplished remote debugging to the Amazon cloud without a VPC/Domain in the cloud?
Any suggestions or solutions would be most appreciated.
There isn't anything different about remote debugging against an EC2 instance than there is about remote debugging against a local server EXCEPT firewall configuration...
I would recommend setting up a VPN connection to the EC2 server instead of opening up firewall ports (PPTP is quick and easy).
If you would rather open firewall ports I "think" you will at least need the following (untested):
TCP 139, TCP 445, UDP 137, UDP 138 (all related to DCOM)
Another thing that always causes issues for me on EC2 instances is not passing the /hostname parameter to msvsmon. msvsmon likes to default to the internal hostname and will startup showing something like "listening on 'ip-1-2-3-4.us-west-2.compute.internal", which means it will ignore attempts for connections from Visual Studio clients that think they are talking to 'ec2-7-8-9-0.us-west-2.compute.amazonaws.com'. To fix this, get the full public DNS name or public IP of your EC2 instance and then launch msvsmon.exe as:
msvsmon.exe /hostname ec2-7-8-9-0.us-west-2.compute.amazonaws.com
Then in Visual Studio:
Tools-->Attach To Process
Set Transport to "Default"
Set the Qualifier to whatever you passed for a hostname when you launched msvsmon.exe

Named Pipes provider error 40 when running on IIS 7, but works fine in cassini

I have a web app which connects to a remote sql server over the internet. It accesses via an alias which is configured with the alias name, hostname, port and TCP/IP as the protocol
I can access the db fine from sql mgt studio and from my app when running with the built in web server (cassini) in visual studio 2008.
I have now installed IIS (win7 64bit) and pointed it at the app. when i run the aplication in visual studio, but configured to connect to the local iis, i get the named pipes provider error 40 message. my iis is running as localsystem - but so is IIS on a collauges pc that works just fine. he claims to have done no special configuration.
i don't understand why. identical code. identical connection string. etc. I've disabled my firewall, no avail.
but it works for my colleague - he appears to have the same configuration that i do. i am stumped. does anyone have any ideas?
my sql client configuration now has only tcp/ip enabled.
any help is greatly appreciated.
are you using integrated security by chance? Casinni I beleieve will be using your user when it connects to SQL, however your local IIS 7 will be using the Application Pool identity, which by default your SQL Server won't allow to connect. You can set your app pool to run as Network Service and then see if can connect.
If you aren't using integrated security this would require more thought.
As a total side have you tried using IIS Express? Just as this is the full power of IIS but runs as the current user, which would again help determine if its a user account permission issue.

Categories