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/
Related
I am creating a .NET console application in C#. This application is a small script which uses the OpenVPN CLI to automatically connect to a VPN server without any manual steps.
I want to block all the network ports from the device, except the one which is being used by the OpenVPN CLI. E.g. port 1194. Can this be done in Windows and how could one achieve this? I tried something with the netshcommand by changing the default gateway of the system, but that resulted in a full internet block. E.g Process.Start with netsh interface ipv4 set address name="Wi-Fi 3" static 192.168.1.15 255.255.255.0 127.0.0.1.
I couldn't find a command/code to block all the ports except one, so any help in this would be appreciated.
Currently I have webservice using dnx hosted on a specific ip address and connecting to it works fine. The service is listening at port 5004 so inorder to connect to it I use the following format
http://192.X.X.12:5004/api/somePar/?...
Now I moved the webservice to Azure and I use the following address to Remote Desktop onto the virtual machine on which it is hosted.
http://MyLink.cloudapp.net:54254
Now I am attempting to connect to it using its web address.Inside the virtual machine where the weservice is hosted if I type
http://127.0.0.1:5004/api/somePar/?.. (WORKS)
The above works. The ipconfig of the machine gives me say A.B.C.D. If I use that as such it fails.
http://A.B.C.D:5004/api/somePar/?..
I guess that is another reason why my other machines cant connect to the webservice hosted on that machine. Any suggestions on why the ip address of the machine fails and the webservice only works with 127.0.0.1
How can I fix this ?
What OS is the virtual machine running? I had this exact problem with a machine running Windows 7 Professional; apparently, if you're running Windows on that VM, it needs to be Windows Server.
Check the binding, it should specify All Unassigned.
And try changing your port to 80 because 5004 is Real-time Transport Protocol used by Real Time Streaming Protocol (RTSP) for Microsoft Windows Media streaming services and some other things and may be locked.
This has been one annoying piece of needle in a haystack.
The C# application is practically complete and I need to test the cooperation of two or more different machines on the same network, to see if they display the same data from the database.
When I run SQL Server + Visual Studio together during development, there's no problem, I use this connection string and everything works OK:
'#"Data Source=PCNAME\SQLEXPRESS;Initial Catalog=POS;";'
I have now published the app and installed it on another machine that happens to be on the same network. Obviously the connection string will not work on that machine because its name is not PCNAME, it's 2NDPC.
But I doubt the answer is to open the solution, edit the cnx string and re-publish for each machine. Even then, how will they be using the same database?
TL;DR
**What I need **
I want to use the machine I developed the application on initially to be hosting the database, to which the local machines can connect.
I've tried forwarding 1434 port and making rules, I've tried starting tcp/ip process in Server Configuration and making sure SQL Browser Agent Service or what not is running.
But no, I either get and error#25 or nothing happens.
Please help and tell me in explicit steps how I can achieve this goal.
1) Enable TCP/IP in the SQL Server Configuration Manager
2) Make sure SQL Server Browser is running, if not, start it, if you can't, right click > properties > service tab > Start Mode = "Automatic"
This is what (excluding people recommending firewall solutions, different programs/sites and downloading stuff to achieve this) I was missing, that nobody managed to tell me.
So .. depending on what you've been doing recently, you may or may not have changed some default values here and there. I'm not too sure if this is default, or if it happened with my win10 upgrade, but either way this worked.
3) In SQL Server Configuration Manager, right click on your TCP/IP item, hit properties, swtich to the ip addresses tab and put in 1433 in the tcp port field under IP1 and IPALL
Instead of pcname, try using TCP/IP address. PCNAME is Netbios dependant. You also need to make firewall adjustments, make sure SQL server is allowed for remote connections and listening on correct port (although 1433 is the default port, you are not guaranteed to have the correct instance on that port).
I have created and published a four part video series on this subject. Although it is about installing our application, 3 out of 4 parts deal with installing SQL server on the host, configuring it for remote access and accessing from clients. Check if you wish, here is the link to the 1st one:
AccuSQL Installation part 1
You need to load your connection string from a configuration file and on publish run a first run wizard or something similar to set the connection string the first time.
To get your 2NDPC to connect, all you'd need to use is the DNS name of the PC and it should work. You may also need to set SQL Server to allow connections on TCP/IP in SQL Configuration Manager.
Also FYI seeing your comment about using IP addresses, you're doing it right, but you don't use \\ in front of the IP. Just replace your PC name with the IP address. EG:
Data Source=192.168.0.1;Initial Catalog=MyDB; ...
I am trying to set up a shared folder with an old Win CE 5.0 device I am using to learn and improve my C# skills.
Possible options to do this can be done via console: net use sharedfolder \\mypc /user:foo /password:bar, to start an extra process from my C# application which then runs the console with the previous parameters or by using the function WNetAddConnection3.
However, I receive every time Error 53, ERROR_BAD_NETWORK_PATH.
I have checked the connection, as well as the path - always error 53.
A connection between another PC and \\mypc works fine without any problems. By comparison of my PC's network connection with the Win CE 5.0 device I have found out that there is only one difference: the Win CE 5.0 device has one WINS-server less. After setting the IP profile manually (IP Address, Subnet Mask, Default Gateway, DHCP, WINS), as well as adding the missing WINS-server, the problem disappears and the folder has been mounted successfully.
How can I fix this problem without changing the IP profile by hand?
In a normal network the WINS will be set by the DHCP server. The WINS entry of a network connection can also be set manually.
The problem with network sharing on Windows Mobile (WM) and Windows CE (WCE) is that it does not allow IP addresses, it only accepts windows network names. If you do not have WINS, a netbios network name can be resolved by the network card using a hosts entry, a broadcast or a WINS server.
As you do not have access to the DHCP settings of ActiveSync, you can either set WINS manually or by code or simply add a host entry for the connected PC. The activesync connected PC will can act as WINS server or , when you enter the netbios name for the netbios share server, the device can simply translate the netbios name to an IP. So either use the activesynced PC or the netbios server IP address as a WINS entry or add the name and IP of the sharing PC to the WCE/WM hosts table (registry: http://windowsmobilepro.blogspot.de/2006/04/etchosts-file-equivalent-in-windows.html).
[HKEY_LOCAL_MACHINE\Comm\Tcpip\Hosts\hello]
"ipaddr"=hex:a1,a3,a5,a9
"ExpireTime"=hex:99,99,99,99,99,99,99
I recommend to use the hosts entry solution and enter the name to use and the IP of the server you want to use.
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.