VPN / SignalR not working together. what can i do? - c#

Have a server with a public IP address and windows server 2019. configured a VPN and when I try to access it through the VPN, signalR is not working.
if I access it through the public IP address it works.
I've got the firewall in off position.
if I go through the VPN it doesn't work.
more information:
all files are in the webserver (js )
doesn't give any error
I cannot see in Fidler anything strange.
VPN don't provide internet access.

See if the ports signalR is using are not blocked in firewall or VPN

Related

How to connect my .net application to SQL Server via internet

I have created a C# application with a login form (I use SQL Server database and SSMS). The database is on my PC, when I run the program on another PC which is in the same network as mine, everything works fine, but when I connect one of the laptops on another network, an error occurs: "The path wasn't found".
Is it possible to connect with the server remotely, via internet or something,
without having to be on the same network?
I already have:
Opened tcp and udp ports
Allowed SQL Server ports in Windows Firewall
Added an inbound rule for tcp (port 1433) and udp (port 1434)
Allowed remote connections
Here is my connection string:
Data Source=<server name>;Initial Catalog=Name;User ID=Minko;Password=Password1
This is not a programming question, but a Networking one.
To have a server reachable in the internet, is a costly mater. The static IP adress alone will cost a pretty penny, never mind actuall hardware.
On a small/no budget, VPN is perhaps the only way. Via VPN you can connect two local Networks (the home side of the Routers), allowing devices to talk as if they were physically in the same network.
No change to the programm is nessesary. If it works local, it works over VPN. The network classes do not care if the target is on the same computer, the same Switch or the Voyager probes.
The user will have to connect to teh VPN endpoint you have to provide - and usually can provide for cheap with any decent Router.
First off you should definitely change that PW.
Also - you make the comment that you are trying to use the same program to connect from a different network - implying that you haven't changed the IP address...
Are you sure you're using your public IP address? (Not your local network one that will start with 10. / 172. / 192.
Make sure you're using your public IP address... if you do this even if you're on the same network it will treat it as if you're not. It seems to me like you're still trying to use the local network's IP.
If it persists make sure you can reach the PC itself: ping ip-of-host in Powershell.
Connecting C# with SQL Server Database in a Local Area Network (LAN)
Try these steps one by one :
1- Find your public IP address using ( www.whatismyip.com ) for example.
2- Check that you can connect to the database using the public IP. To do that go to SSMS, and in the server name try to use IP-address only, or "IP-address\[instance-name]. If doesn't work, then you have to fix this first. Check this: https://dba.stackexchange.com/questions/62165/i-cant-connect-to-my-servers-sql-database-via-an-ip-address
3- When step 2 works, then you can use the "IP-Address\[instance-name]" in the connection string.

Accessing Grapevine REST Server over network

I want to implement REST interface for my application. After some search, I select Grapevine (Got from stackoverflow itself.). It works fine. the problem is, the server accessible using localhost only. Even the server listening on 0.0.0.0:8080, the server is not accessible over network. Also only hostname localhost is working. Please help me to solve the problem or suggest another .net REST server.
If you can't reach the server from a remote machine, you are likely running a firewall that is blocking inbound traffic to the port you are listening on. Try opening the port on your firewall, and see if that works for you.
How to Open a Port in the Windows 7 Firewall
Use "+" as hostname and reserve the url by using the netsh utility:
netsh http add urlacl url=http://+:8080/ user=everyone
For more Information Notes On Using HttpListener

websocket can´t reach local network client service

Having some trouble with websocket-connection within the local network.
Scenario:
For my laptop (Win7) I've written a service which opens a websocket-server to port 2014. Because websockets aren't enabled by default for windows 7 I'm using the supersocket library ( http://www.supersocket.net/ ).
For the Client I've written a android app with sencha touch and Phonegap. To enable websocket- support for android devices with version lower 4.4 I've integrated the phonegap websocket- pugin.
The reason is to open a websocket-connection between the android device and the laptop to control the laptop by the android app. Both devices are members of the same local network.
The problem:
After installing both applications (windows service and android app) I've tried to connect my android device with the service from the laptop. First step is to open the connection on the client:
var connection = new WebSocket('ws://192.168.178.21:2014');
But in the event-logs of my windows service there is no successful connection logged.
After that I opened the browser of my laptop and tested the same code - successful. Client and Server could communicate with each other.
So I've tested the websocket-support on my android device: changed the websocket-url to
var connection = new WebSocket('ws://echo.websocket.org');
and could connect to the server -> Android websockets are okay.
Third step was to disable my firewall and check the connection with Wireshark:
Screenshot:http://www.directupload.net/file/d/3710/y9t79npy_png.htm
192.168.178.21 -> Laptop IP
192.168.178.23 -> Android device IP
So it seems that the packets reach my laptop but not the service. Additional tried to use the secure wss:// protocol - no victory.
Don't have any ideas anymore. Would be a pleasure to get some help :)
So it seems that the packets reach my laptop but not the service.
Could it be that the server is binding to a specific IP address or hostname? Often servers will implicitly bind to all interfaces, such as 0.0.0.0, but sometimes they bind to one specific interface. If that happens, then you need to connect to that same interface.
You said your client is connecting to ws://192.168.178.21:2014, but could it be that the server is binding to 127.0.0.1 or localhost or your hostname, and therefore doesn't see the request? That could explain why the laptop received the request, but not your service.
Then again, you said you tried it from your local browser, and it worked. Did you use the same IP address, or did you use 127.0.0.1 or localhost? Assuming you used the same IP address, 192.168.178.21, then that would indicate it's not the bind issue I described.
Sorry, that's all I can think of at the moment.
After some time i´ve found the solution:
Had to add the firewall rule to the public firewall options.
Thanks for your help:)

firewalls block client of wshttpbinding service

I have a server pc with Windows Server 2008.and i also have a wcf service that work with Port 8525 and host it with Windows Service.i open the port in server firewall (Added Rule).
My server machine has a Valid IP. so my client try to connect to my service at
((http)://MyServerIP:8525/ServiceName).
all of my application users are people that work in companies.so user internet come from a secure network (Proxy Server Or VPN Connection).
the problem is here :
lots of my clients have the connection problem that seems local network block my program connection (if they try to connect to my server system.diagnostics listener will log it) but service does not save any log.
i think their internet Server has Firewall and it block me.i fixed some of them with
<defaultProxy enabled="true" useDefaultCredentials="true" />
but still lots of them have same problem.and the another annoying problem is the network administrators do not open that port because of security issue and do not help me.
A Common Exception is :
System.ServiceModel.EndpointNotFoundException > System.Net.WebException > System.Net.Sockets.SocketException (on client Side).
this problem did not occur when i connect from home.
My question :
any way to fix this issue with c# code or client app.config? or at least fix this with some change in service config (server side).
The only easy solution is to host that service on port 80
The problem is that some networks do not permit outgoing connection to ports other than permitted services(http,https,pop, etc etc)
Or you can ask sysadmins of those networks to permit traffic to your ip/port
If you have iis on that server you could host wcf on iis.
Remenber that only one process can bind to a port on an address at any one time.
there you can find some info: How can a WCF service listen the same port as IIS?

HttpListener not receiving remote requests, even with the firewall down and all prefixes registered

I've written a server using HttpListener that works perfectly well for requests sent from the same computer, but doesn't even receive requests sent from a remote machine. I've tried using (including registering with netsh) the following prefixes: http://*:8080/, http://+:8080/, http://localhost:8080/, and the specific IP address of the host computer followed by port 8080. (I also made sure no other applications were using 8080.) I opened up the appropriate ports in the firewall, and when that didn't work, I turned off the firewall just to see if it was a firewall issue and that also had no affect on the problem. I have no idea what to try next, please help!
Also, the machine running this web service is a Amazon Web Services Microsoft Windows Server 2008 R2 with SQL Server Express and IIS EC2 instance.
If you are using AWS free tier EC2 instance, adding the given public elastic IP as the prefixes will not work for you even after you have the local firewall port and ports in security group opened. The HTTPListener needs to be bind with the public DNS provided by AWS. Then only it will work.
For future users, the solution in more detail was to add an Inbound Custom TCP rule that included port 8080 in the 'Port range:' to a Security Group used by my EC2 instance.
thanks to #shashankaholic for pointing that out

Categories