connect localhost from another machine - c#

Is there anyway i can navigate to a website i develop on my computer from a smartphone connected to the same network?
the site is running on localhost, can I make a bridge or something like that?
thanks.

I think you can if you use you're IP directly as the website's name.For example in TOMCAT all the sites are localhost:port/Project_name/filename.html
So if you would use "http://your_ip:port/Project_name/filename.html", it should work.
As a note, the firewall may stop this from working.

As long as your site is available to the network, just use the name of your PC.
So if you were developing on http://localhost:12345 connect using http://muzE-PC:12345 (assuming muzE-PC was the name of your computer)

instead of localhost use, ip address.
Make sure that website is not blocked by windows firewall.
ipconfig can be used to determine ip address.
On remote system, localhost will refer to that remote system (not the system on which web site is running).

Related

c# restful selfhosted api winforms works with my local ip but dosent work with my plubic ip event with port redirect

So the problem is this, I created a restful selfhosted api, to work with my mobile app, on the app mobile I stored my public ip (190.xxx.xxx.xxx) when I try to consume the api from the same network donset work no response, If I go 3g or in anoter network its work fine.
I try on my browser those 2 situation:
http://localIp:port/api/Menu/... its work
http://externalIp:port/api/Menu/... dont work - ps. this work only if I on a diferent network or 3g.
But I need to keep sotored my plubic IP for the external users and I dont want to store 2 ips internal and external to check if the user is on local network or external.
in summary my clients can use the app outside the office, but in the office with wifi connected they cant.
Tks for anyhelp
I found this and solve my problem
https://docs.connectwise.com/ConnectWise_Control_Documentation/On-premises/On-premises_knowledge_base/Cannot_access_external_IP_address_from_LAN
Introduction
In some scenarios, a user cannot use an external IP address to access a machine on their local network. This is typically a result of security measures put in place by routers and referred to as a Network Address Translation (NAT) loopback issue. This article will discuss what this means for ConnectWise ControlĀ® on-premises users and will provide some suggestions.
What is NAT loopback?
Many routers and some security tools prevent loopback connections as a security feature. This means that a machine on your local network cannot connect to the external IP address (such as 208.112.93.73) of a machine that is also on your local network. Connecting to a local IP address (such as 192.168.0.2) of that same machine works fine.

Why is the uri for a self hosting application set as localhost?

I recently started looking into Asp.net Web Api self hosting. I'm following this article and I have two questions based on that.
Why is the URI for HttpSelfHostConfiguration pointing to localhost?
How would I give a website name like I would in IIS for the windows service? Because if I deploy this to a production server, how would the clients call the localhost?
Q. Why is the URI for HttpSelfHostConfiguration pointing to localhost?
A. localhost simply just means "this computer". It's typical to do it this way to make the intent clear. Nothing stops you from using an ip address.
Q. How would I give a website name like I would in IIS for the windows service? Because if I deploy this to a production server, how would the clients call the localhost?
A. You would change from HttpSelfHostConfiguration("http://localhost:80") to HttpSelfHostConfiguration("http://000.000.000:80") where 000.000.000 is the ip address of the host (the machine you are running the web application on)
Localhost is reserved loopback adres (ea 127.0.0.1) try ping localhost.
The origin is basic networking, it existed before .net
Pinging localhost was quite common to check if your own network card still worked. As it ping 127.0.0.1, is a ping to your own network card. Next step in conectivity issues was pinging your gateway and then some remote IP or so.
A client cannot connect to a remote localhost (it will point its own network card).
in regard to the article, a server listens to its own network card.
unless you have some multiple nic environment with specific routes to follow
but then there is a config file for that.
Localhost is the default allocation of Windows, if you want to change the default name binding,
answer is simple just go to
C:\Windows\System32\drivers\etc\ folder
you can find as hosts file there just open it in notepad, if you want to change the locally hosted name add a new line in that text file like
127.0.0.1 domain name you want to use
for example
127.0.0.1 techdoubts.net
then your localhost will be changed to techdoubts.net
and one more, add that new name in internet information services website binding also.

Consuming Asp.net web service from remote computer

I create Asp.net WS and host it on the IIS.Now i want to consume it from remote computer or another computer.When i insert the URL of the WS on the remote computer an error message appears inside internet explorer browser page says
This program cannot display the web page
i work on Visual studio 2008, windows 7 and the client application is Asp.net website.
i don't know what is the problem??
have i connect the two computers with LAN(make network between them) or just enough each one connect to the internet??
Your computers need to be able to connect to each other.
If they on LAN, then You need to specify LAN address for asp.net WS.
Also check Your firewall for blocking connections, need to be sure that port were IIS hosted is available for connection
If nothing helps, then provide us more information about problem.
Really i don't know what is the problem.When i do the same thing in another computer it runs but on my laptop doesn't run.

IIS not serving website pages on remote client

I am new to IIS and asp and i am having a problem. I am creating a asp.net website in physical folder wwwroot\SharePage and virtual directory SharePage When i visit the site on local host or using my ip address or through dyndns proxy on my own computer , the page is served fine, But when any one else from any other computer access my website it takes a long time in loading and finally his browser throws an error (may be page not found error,not sure, see for yourself). I have even changed Authentication mode to none and tried with firewalls closed , still page is not served.
You can have a look here
http://thesharepage.dyndns.org/SharePage
(hosted on my home computer so can be unavailable at times when i have switched off my computer)
or try with my ip address
updated
http://117.205.103.192/SharePage/
(can change ,i have a dynamic ip address)
Info:
IIS version 7.5
OS : Windows 7
.Net 4 (even in IIS)
please help quick, have to launch it on New Year
Port 80 isn't open to the outside world (I can't telnet to it). Sounds like IIS is working but your router needs some configuring to forward that port to the server.
I don't think so it is an IIS issue, possible related to firewall. You may need to enable 80 port in your firewall. You may also need to enable port forwarding in your router, even http://thesharepage.dyndns.org/ is not accessible from here.
It seems you have not allowed outsiders to access your webserver from outside. This is the default setting in the firewall. Change the setting in your firewall and things will be alright.

10013 error (AccessDenied) on Silverlight Socet application

I am writing silverlight 3 application which is working on network.
It works like client-server application. There is WinForm application for server and silverlight application for client.
I use TcpListener on server and connect from client to it with Socket.
In local network it works fine, but when I try to use it from internet it don't connect to server.
I use IP address on local network and real IP with port number for internet version.
I get error 10013 AccessDenied.
Port number is correct and access policy exist.
Firewall is turned of.
Where is the problem?
Thanks.
Have you tried to check the general availability of the connection from your machine to the Internet server with telnet ?
The problem was that computer, where hosted website hasn't real IP address, and I couldn't connect to it from internet. I added Real IP address and everything works fine now.

Categories

Resources