Using ASP.NET Web Api from another computer on the local network

I thought it over, but did not find anything that could solve my problem. (I'm new to ASP.NET Web Api)

I created ASP.NET Web Api, and when I run it from visual studio on the local machine, everything works fine. (in both cases, it works fine when I use "Use Visual Studio Development Server" and also "Use Local IIS Web Server").

The problem is that when I tried to call this web service from another computer on the local network, it did not work (something like: "http://192.168.2.103:8080/api/blabla"). (1) using "Using Visual Studio Development Server" - the client ends the timeout. (2) using "Use the local IIS web server" - the client received an HTTP ERROR 400 "Bad Request - Invalid Hostname" (this is when I use port 8080 and the added rule for the Windows firewall to forward this port).

I also tried to completely disable the Windows firewall, antivirus, and this did not help.

I have another project of the http web service implemented in WCF, and everything is fine there, I can transfer it from another computer to the LAN.

ATTENTION! (1) another computer is not a window .... if it is important) (2) ping between computers / addresses works fine.

I will be very grateful for any help. thanks,

Haim

+4
source share
1 answer

(1) Visual Studio Development Server does not support remote connections. See more details . People use workarounds, such as setting up a reverse proxy in these scenarios.

(2) โ€œLocal IIS Web Server,โ€ I assume you are using IIS Express. Unfortunately, IIS Express does not allow remote connections by default. To allow remote connections, see question .

+1
source

Source: https://habr.com/ru/post/1434618/


All Articles