2014-10-10 64 views
7

如何將owin web服務器配置爲可從其他主機訪問。所有示例都配置爲localhost。我可能不知道URL是什麼。 (IP地址/主機名)如何配置owin/katana以偵聽所有主機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(); 
     } 
    } 
} 

回答

14

您可以通過使用 '*' 改變你的網址監聽所有適配器:

static string url = "http://*:9080"; 

這將減少限制比本地主機。

相關問題