如何配置owin/Katana来监听所有主机IP地址

cos*_*oan 9 c# owin katana

如何配置可从其他主机访问的owin Web服务器.所有示例都配置为localhost.我可能不知道URL是什么.(IP地址/主机名)

码:

class Program
{
    static string url = "http://localhost:9080";
    static void Main(string[] args)
    {
        using (WebApp.Start<Startup>(url))
        {
            Console.WriteLine("Server running on {0}", url);
            Console.ReadLine();
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

小智 17

您可以使用'*'更改您的网址以侦听所有适配器:

static string url = "http://*:9080";
Run Code Online (Sandbox Code Playgroud)

这将比localhost更少限制.