Self Hosted WebApi available on LAN

Very new to Self Host WebApi, but I am very impressed with its ease of use and extensibility. At least through this lesson . Everything I have done so far works on my development machine, whether I use localhost, 127.0.0.1 or my LAN Ip (192.168.0.x), but I'm puzzled why I cannot access the service with any other computer, even from others on the same subnet.

Shortly after completing the tutorial on the computer on which it is running:

localhost:3636/api/products/ 

results in the expected xml return. On another machine on the local network, browse:

 192.168.0.x:3636/api/products/ 

leads to a data point timeout for those who can know how all this interacts:

1.) On my developer's machine (192.168.0.x, server, host, as you want to call it) IIS is installed; I was so paranoid that I stopped it through the admin GUI.

2.) I reserved the URL / port for the following command line executions:

  >netsh http add urlacl url=http://+:3636/ user=DOMAIN\USER listen=yes delegate=yes >netsh http add urlacl url=http://192.168.0.x:3636/ user=DOMAIN\USER listen=yes delegate=yes 

2.b) I tried both of them together and individually, and tried to change the user to "all" to no avail

3.) I tried changing the code in the tutorial to install

  config.HostNameComparisonMode = HostNameComparisonMode.Exact //default is Strong Wildcard 

4.) I can successfully ping and trace up to 192.168.0.x from other machines on the local network

5.) A friend recommended that I install TCPListener and make sure that I can connect to it to exclude the firewall. If this logic is correct, the problem is not the firewall

EDIT: Thanks for your help, here is another data item that I believe confirms that this is not a firewall problem. Earlier, I published this connection when I was behind a rather dumb (at least, not such a certified guy like me) Juniper Firewall / Router. Since then, I redid the textbook on another machine (without IIS) on my home network and still cannot publish the service on other computers on my local network. Any ideas?

+8
source share
3 answers

Well, this is not a hardware firewall, this is a Windows firewall ! yikes I spent a lot of time on this. As soon as I turned off the Windows firewall (the code works on the intranet anyway), everything works.

Does anyone know a good site that explains how firewalls and conductors interact; or I suppose this should be just one first test.

+2
source

I would try a couple of things:

First of all, get rid of the HostNameComparisonMode line. This can actually disable requests coming from other computers.

If everything still does not work, try to get rid of the URL ACLs and run the application as an administrator and see if it works. If this works, you can add the URL ACLs again and not start as an administrator. You will only need one with "+" as the host name.

0
source

I ran into the same problem when trying to use the host using OWIN. What worked for me -

What is it! I was able to call my api from other computers on the network.

Hope this helps ...

0
source

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


All Articles