Why can't I make an http request to the ASP.NET development server on localhost? - asp.net

I have an ASP.NET project (VS2008 on Windows 7 with either webforms, MVC1, or MVC2 -- all the same result for me) which is just the File->New hello world web project. It's using the default ASP.NET development server, and when I start the server with F5, the browser never connects and I get a timeout. I tried to debug this by telnetting to the development server's port while it was running, and I got the same result:
C:\Users\farmercs>telnet localhost 54752
Connecting To localhost...Could not open connection to the host, on port 54752:
Connect failed
I can see in the system tray that the server thinks it's running, and a netstat -a -n command shows that there is indeed an active TCP listener on that port.
This worked in the not-too-distant past, and I could work on web projects using the development server. One thing that has changed since then was that I installed the Microsoft Loopback Adapter to accommodate a local development Oracle installation. I'm not sure this is the problem, but it seems a likely culprit.
I also tried to hit the port using the server name itself (http://mycomputername:54752) but with the same result.
So, what could be blocking me from connecting? And if it's the loopback, then what is a good way for me to retain my ability to connect to my development Oracle server while still being able to use the ASP.NET development server?

have you checked your host file?
%SystemRoot%\windows\system32\drivers\etc\host
look if there is any redirection of localhost or 127.0.0.1 to somewhere else rather than your pc

Related

SocketException: No connection could be made because the target machine actively refused it XX.XXX.XX.XXX:443

I got 2 servers with two equal wcf services hosted on them and one client application server. I can connect to endpoints and send a requests to both services using test wcf client app (.NET Web Service Studio) from my local machine successfully. But when I am trying to connect from client application server using the same test wcf client app I successfully connected only to the one wcf service server, but I have got an error when connecting to another one:
System.Net.WebException: There was an error downloading 'https://XXX/XXX?wsdl'. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it XX.XXX.XX.XXX:443
I performed netstat -an | find "443" command in command prompt on the client server and on my local machine to find out the difference and here what I have got:
1. On my local machine:
2. On the client app server:
What I already tried to do on client application server is:
- turned off firewall;
- stopped windows firewall service
- uninstalled mcafee virusscan enterprise application.
(I tried to set "prevent mass mailing worms from send mail" first, but mcafee was in foreign language that I don't understand, so I just uninstalled it)
after running command netstat -aon | findstr "443" on client application server I have got this result:
but I still got an error.
Does anybody know how to solve this issue?
Could be the problem on the wcf service server side?
The solution was predictable simple one - firewall was blocking the port,
but it's important to notice that the issue was caused by firewall on the wcf service server side, but not on client application server, which is making the request to that service.
I asked the technical support of that server, and they made firewall changes.
After that error was disappeared.
I faced the same issue and tried different ways to fix this. Nothing works. Later i found the issue which is, the application i tried to run is https and in my IIS, https binding was not created. I created binding https with the website and it works.

IIS 7.5 running on Win7 Pro - access through a port other than 80 or 8080

I'm not sure I can adequately explain my dilemma, but here goes...
Our company has its own web server at xyz.com. I have a Win 7 Pro machine running a non-HTTP server program that communicates with an iPhone app used by our field crews. The path to this machine from outside the network is abc.xyz.com, and it's set for port 5000. The app, then, is programmed to exchange data (ASCII only) with the server at abc.xyz.com:5000. The server program is written in VB, and the system works very well like that.
What I would like to do now is to add IIS to this same machine and open it on port 5001, so I can run asp.net pages that will enhance the functionality of the app for our crews. The URL would be abc.xyz.com:5001, and they will access it through their phone browsers.
I have IIS 7.5 installed on the machine, and I have started it running with the "default web site," and I have the binding set for port 5001. So far I am able to access the IIS "Welcome" page only from the same machine. I can't get it to come up on any other machine either inside or outside the network.
In searching for clues for this problem, all I read indicates that it's pretty much a snap to get a web server running on your Windows 7 machine. But it hasn't been so much a snap for me. I've checked the sharing settings and the security settings, they seem to be ok, as best I can tell.
I am hoping that someone will help me identify some obscure setting somewhere that I am overlooking and get this going. But I also even wonder if this is something that can't be done, i.e. because there's another server program using the same path running on port 5000.
By the way, I am not the network administrator. I try to avoid getting him involved because he's difficult to work with. I am hoping that this is just between me and my server.
Thanks for any insight anyone can give me.
You mention that you can access the website from the machine itself on port 5001, but you can't access the site from another computer within the same network - this suggests to me that the Windows 7 built-in firewall is blocking the request - as it's a non-standard IIS port.
You should configure the firewall to allow incoming requests on port 5001. Open a command prompt (as administrator) and run the following:
netsh advfirewall firewall add rule name='IIS Website on Port 5001' dir=in protocol=TCP localport=5001 action=allow profile=any
I found the answer elsewhere on StackOverflow. I needed to add IUSR to the list of authorized users. So far I have tested it on my iPhone browser using 3G and it came through. Seems likely that it will work from anywhere, but I'm not yet ready to declare total success.

How to access ASP.NET app from another pc on the same network?

I'm running a ASP.NET on my pc and I would like to access to that app from another pc on the same network. I've tried to reach the app writing the URI of my pc on the network followed by the port number as below:
"192.168.X.X:49223/"
But it shows me an 400 error saying that it's an invalid hostname...
Is there something to do with my windows firewall or in IIS to allow access from another PC ?
Thanks for your help.
You may need to an exception in Windows Firewall.
Control Panel > Windows Firewall > Advanced Settings > Inbound/Outbound rules.
Add a new rule to both, specifying your port number and a generic name to identify its purpose.
Install IIS server on your machine, then deploy your application on that IIS server.
Refer this for Deployment assistance
To run the application on IIS instead of ASP.Net dev server you need to
Right click on solution in VS
Click on Start Options..
In Server section, Select "Use Custom Server" and then provide the URL of the application you have added earlier on IIS
Then you can easily access your website from any other machine on the same network.
Is it hosted in iis, or are you running it through Visual Studio. The funny port number (49223) tells me it's the latter.
When you run a VS project, the dev server is designd to only allow local conconnections. If you connect from a network it gets blocked by design. Their is no config around it.
What I do as a hack is run a reverse proxy like Nginx. It's a free download. Run it on your dev machine. You can tell it to listen on a port (eg 88) and then redirect tge traffic to port 49223. Give your mate the same url as before but replace the port with 88
Nb make sure your port 88 is open as per codemans answer
An example of the nginx config would be https://gist.github.com/ekinertac/5524389
This then tricks VS into thinking it came from your local machine.

Windows Server 2008 R2/IIS 7 refuses all outside tcp connections

I am unable to connect, for example, via http to a brand new installation of 64-bit Windows Server 2008. The server is on a domain, but is not DC (that's another problem altogether).
The IIS7 is running on the server and the website is accessible locally via http://localhost, but when I try to connect from another machine on the same network, the connections is refused, even though Windows Firewall is disabled.
I am able to connect to and browse the shared folders on the server using Windows Explorer, so it is not a physical connection issue. I can ping other machines on the network from the server, but trying to ping the server from another machine results in "Destination host unreachable".
As far as I can tell, the server refuses any TCP connections from any machine. I am thinking, there must be some other configuration setting that I am missing... Please, help.
NS
Like in Windows 7 the behaviour is determined by the network type (home, work, internet) the OS thinks it is connected to... even with a disabled firewall it respects these settings and accordingly refuses/allows connections...
The solution is embarrassignly simple, and the credit goes to Ashley Steel, on ServerFault.com for asking just the right questions. It turns out that the DNS was resolving the name of the server incorrectly, because the machine was named the same as an old, since decommissioned workstation that used to live on the same subnet.
The solution: rename the server.
NS[Now hiding under a rock]

Accessing asp. net development server external to VM

Guys, been knocking my head against the desk (instead of the mac) for hours. I'm running VS 2008 in a parallels VM. I can access the development server in the VM if local host is used, if I use the designated ip for the VM or try to access it externally it does not work. All firewalls are off and I verified that I can access iis externally.
Any Ideas what could be wrong?
I ran into this same problem and am using a TCP tunnel to bypass it. Download this Java app & just tunnel the traffic back. No messing with IIS necessary!
http://jcbserver.uwaterloo.ca/cs436/software/tgui/tcpTunnelGUI.shtml
In command prompt, you'd then run the java app like this... Let's assume you want external access on port 80 and your standard debug environment runs on port 1088...
java -jar tunnel.jar 80 localhost 1088
Yes, it is by design. Consider using IIS instead.
The first answer is that you can't do it because the development server is specifically made to just run locally, otherwise it becomes a security risk.
The second answer is that you can get around anything, this hints that there is a way to do it using a reverse-proxy (but the post he links to seems to be dead)
EDIT : After viewing RichardOD's answer, I fear that my answer below is wrong and you can not access it using IP.
But I suggest you to go with deploying it to IIS.
The VS2008 internal web server ( which I guess is cassini ) creates a port for your app and runs a web server for your app on that port. If you want to access it from outside the machine you have to use that port in addition to IP.

Resources