Unable to call ASP.NET Web API hosted on IIS 10, Windows 10 - asp.net

I have created ASP.NET API endpoints on my Windows 10 PC, hosted on IIS. Using Chrome's extension app, Postman, I could call the API internally within the same machine (using localhost and even my own local IP). Example:
http://localhost/UserService/api/user/getByUsername?username=abc
and
http://192.168.0.160/UserService/api/user/getByUsername?username=abc
Then I tried using another PC (Windows 7) to connect to the same Wifi LAN that my Windows 10 PC is connected to, and attempted to call the above example URL via Postman, but it did not get through (getting "Could not get any response"error). The Windows 7 PC could not call API hosted on Windows 10 PC.
However, when I reversed the setting ie to host on Windows 7's IIS (version 7.5) and used Windows 10 PC to call instead, no issue found.
What went wrong?? Is it due to some Firewall settings?

A few things to check in Windows Firewall with Advanced Security:
Have you enabled the World Wide Web Services (HTTP Traffic-In) rule
in Windows firewall exceptions?
Do you have any entries in the Remote Computers tab?
Is the action Allow the connection?
What is the content of your Advanced tab like?
EDIT
Based on your comments, the issue is indeed a firewall issue, but not Windows Firewall with Advanced Security. McAfee firewall is blocking external access to port 80. Add an exception to McAfee to allow port 80, and possibly 443. Consult McAfee's knowledge base.

With great help from #reckface, the root cause is found, which is in fact the McAfee antivirus itself. After exploring around the UI, I found the setting to allow incoming traffic for certain port(s) without needing to turn off firewall setting entirely.
With "Web Server (HTTP) Port 80" enabled on the UI, I can now access API's from another PC.

Related

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.

unaccessible IP address using IIS 7

Recenly a network card was intalled on the server so that I can have a new IP address for my application.
Whend deploying the application on the server using IIS (using the "add site" feature) and then test the site , the site works perfectly fine from withtin the server
but when I try to access it from outside the server I get the message saying that the site is not reachable
any reason why this is happening ?
Sounds like a firewall issue. First make sure the windows firewall isn't blocking IIS. Also make sure your IT team has setup that IP address as an external server.
A few other questions about your server
1) What type of services are you hosting and is it on the standard ports? (Exhaustive list of ports on Wikipedia)
2) What version of IIS are you using?
3) Do you have a firewall/load balancer/etc between your server and the web?

Asp.net Application Accessible to other machines

I have application..its runnning on my localhost.. i need one more machine to access that application.. but when in tht link i type my IP address instead of localhost.. it showing cannot find server.. can you plz tell me steps what i need to do in orderr to access appplication to other machine.. as such there is no UAT server as of now...
First off, make sure your firewall allows access through port 80.
Then, check if your IIS allows access from outside IP's.
I can help more if you provide this:
Your OS (XP, Windows 7, etc)
the local link to your app. Is there a port number needed to access the app?
LaterEdit: Ok, then you need to do this:
Now, your app will be served by IIS on port 80 (default). Check your firewall to allow traffic through this port.
If you IIS is set for another port, then use that one.
Checking the port in IIS:
I'm going to assume that you are running the application from Visual studio which allows the localhost to run.
In order for your application to be available to other machines on the network, you have to ensure that IIS is installed on your development machine and then a website is set up for that application as well.
The application existing in IIS is what will make it accessible across your network.

IIS Express (WebMatrix) open for outside connections

I've already enabled firewall rules for IIS Express (HTTP Traffic In) and IIS Express (HTTPS Traffic In) on ports 80 and 2012 (this one is used in WebMatrix), but I can't connect to the server from my LAN. WebMatrix is running on a virtual Windows 7 machine.
Is this a limit of IIS Express?> Yes - you can redistribute IIS Express with your applications. There are no connection limits.
ScottGu's blog
It is possible though it takes some effort, there's a great blog post on this here and Vaidy talks about IIS Developer Express on the CodeCast podcast here.
Is it listening on local ports only, i.e. do you see 127.0.0.1:80 not 0.0.0.0:80 on netstat -an?
I haven't played with IIS Express yet so I don't know what the default is or how to configure this.
I was trying your same configuration and was unsuccessful in opening the Windows 7 firewall to just IIS Express. I was successful by opening the port I was using (80) to any application rather than restricting to just one application. My guess is that IIS Express goes through a service (HTTP.SYS?) and that needs to be allowed but I have not yet researched that.

Resources