OWIN outside the network can not access

When using OWIN configuration API, IP address fill 127.0.0.1, use only http://127.0.0.1: port / api / access, and can not access the external network.

            string url = "http://127.0.0.1:端口";
            using (WebApp.Start<Startup>(url))
            {
                Console.WriteLine("Api running on {0}", url);
                Console.ReadLine();
            }

Instead localhost, too, can only be accessed by localhost, and the external network can not access;

If you change the external IP network IP, start api error.

It was discovered that if the server has open outside the domain name, use http: // domain: port number to start api, it can start, external access, no problem; if the server is not open outside the domain name, use http: // Native ip: port number to start api, api using external network ip access outside, no problem.

But the drawbacks of these configurations is that, when accessed by the machine, which is used in api start address, the machine can only use the api access address configuration to access.

Eventually we found a way that can be solved using a configuration, multiple access problem

            string url = "http://*:端口号";

            using (WebApp.Start<Startup>(url))
            {
                Console.WriteLine("Api running on {0}", url);
                Console.ReadLine();
            }

 

Guess you like

Origin www.cnblogs.com/JqkAman/p/11332874.html