I made an Api using Asp.Net and lauched it on my Ubuntu VPS. I can access it locally using localhost, but when i try to access it using ip, i get the connection refused error. I tried setting up nginx, now it redirects from port 80 to port 5000, but i still get the connection refused error. Why is my Api not accessible remotely from the Internet? I spent a whole working day trying to solve this, and I am desperate at this point.
Here is the link to my question about nginx: Asp.Net + Nginx. Works if using localhost, but fails if using ip
Solved: I needed to use the command line argument --urls http://*:5000
Related
When I debug my project the browser show "SPA proxy launch page" with port 7253 the redirect to my application with port 44483.
However, I have noticed that the SignalR Hub is running on port 7253 instead of 44483. I found this problem once I tested with Postman. It return 404 for port 44483 while it work with port 7253.
I'm a bit confuse because my swagger page is working well which is running on port 44483.
Anyone have idea on what is going on?
I refer to this tutorial https://learn.microsoft.com/en-us/aspnet/core/tutorials/signalr-typescript-webpack?view=aspnetcore-6.0&tabs=visual-studio
I'm running VS2019 community, and I've created the default ASP.NET Core Web API project (ASP.NET Core 5.0), the one with the simple weather forecast example. And I am now trying to connect another computer to the URL. I run the example by using the [application name] in the run dropdown, and not IIS Express.
Both computers are connected via wifi to the same Router.
I do an ipconfig on the server machine to get it's IP (192.168.1.108)
And I have also enabled inbound connections from the ports 5000-5001 in the windows firewall setup
On the "client" machine I try to access the server with :
http://192.168.1.108:5000/swagger/index.html
or
https://192.168.1.108:5001/swagger/index.html
but neither seem to work? The page ends up timing out.
So on the machine running the server, I also completely disabled the windows firewalls (temporally, just to get things working).
But still get the same result?
Have I missed a step?
Maybe this will help you. Try to add IP of your host into Program.cs
var host = new WebHostBuilder().UseUrls("http://192.168.1.108:5000")
I am developing bot solution, in which I am making REST call to get some details from other server.
In local host my code is working fine, but after publishing the code in Azure I am getting the below error:
System.Net.WebException: No such host is known No such host is known —> System.Net.Http.HttpRequestException: No such host is known —> System.Net.Sockets.SocketException: No such host is known
I am using HttpWebRequest option.
May I know what could be the reason?
I'm not sure the solution below will work for you but it looks like the solution is worth to be checked out. Here is an answer that may have useful information. Take a look at this answer and check your solution accordingly:
The problem description:
I deployed a .NET Windows Service on Azure Virtual Machine running
Windows Server with an opened port that allow me to connect to it,
this service is like a server using socket. The problem is that when I
try to connect from my PC to that hosted server it doesn't work and I
get this exception: System.Net.Sockets.SocketException: 'No such host
is known'. The port is opened and visible from my PC. Can someone tell
me why I get that exception? If I run locally all works ok.
The answer:
The Exception seems to be a DNS issue. I am not familiar with C#, from
networking, you could check the followings on your side:
Windows service is running and the port is listening on the Azure VM.
The port is allowed for outbound traffic from your PC and Inbound
traffic on your Azure VM. Check the VM firewall settings on both sides
between your PC and Azure VM. Also, you could check the NSG settings
follow this. You could use telnet vmpublicIP port on your PC CMD to
verify network connectivity.
Verify your PC can resolve the address of the hosted server if you connect
it via its DNS name. You could use the NSlookup or DIG to verify this.
If it's DNS issue, you also could add a line in hosts file (located in
%WINDIR%\system32\drivers\etc on windows) mapping the hosted server's
IP to a name. Hope this helps.
.NET Service System.Net.Sockets.SocketException: 'No such host is known'
So I've recently copied the codes from https://www.codehosting.net/blog/BlogEngine/post/Simple-C-Web-Server
to learn about how to host a server from a C# winform. The issue is, even though the example code worked perfectly fine when I accessed localhost from my local computer, when I attempted to connect to the same server using the url http://192.168.x.x:8080/test/ from another wifi-connected computer I get error 503 : Service Unavailable.
All the similar questions I found so far on stackoverflow concerns the use of IIS. I haven't used such services, merely utilizing ASP.Net and nothing else. Previously, I had the error 504 (Bad Hostname) but that was resolved through cmd command (netsh http add url ...) , and I've also opened the port by modifying the Inbound Rule to allow connection through port 8080. However, this 503 error doesn't seem to go away...
Looking forward to any kind of help
I am using a 3rd-party tool that runs as a Microsoft Service on a Windows Server 2008 R2 machine. The machine is using a Dell SonicWall firewall. The tool has defined ports that it is listening on of which I have opened one. Using an external web tool that port is listed as open. The service has been installed and shows as running when I run services.msc.
Everything runs great on my local machine. However, when I try to query the service I get a 403 error. The following is what the query URL looks like:
https://{siteUrl}:{portNumber}/scanservice/v2/getstatus?method=jQuery111106758983342442662_1428439579840&_=1428439579841
This is an AJAX GET request coming from an ASP.NET MVC application.
The code attempts to find an open port by querying 3 ports that are the https ports for the service. The first two are ports that I have not opened on the machine. These queries time out which is what I would expect. The last port is the one I have opened on the server. I immediately get a 403 error.
Is there somewhere where I need to expressly allow that service, not just the port?
It is a case where your public IP is not whitelisted on the web service hosting server