Search code examples
asp.netiisasp.net-web-apiwindows-10iis-10

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


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?

enter image description here


Solution

  • 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.

    enter image description here

    With "Web Server (HTTP) Port 80" enabled on the UI, I can now access API's from another PC.