static void Main(string[] args) { Init(); ServerHost httpHost = new ServerHost(); httpHost.Run(); Console.WriteLine("HTTP监听设置成功。"); Console.WriteLine("站点网址:" + httpHost.Option.HttpListenerOptions.First().ToUrl()); Console.WriteLine("EXIT: 退出模拟服务,cls: 清屏。"); while (true) { string input = Console.ReadLine(); if (input.Is("exit")) { return; } if (input.Is("cls")) { Console.Clear(); } } }
private void btnStart_Click(object sender, EventArgs e) { if (_host == null) { _host = new ServerHost(); _host.Run(); // 使用默认的配置文件启动监听服务 } else { _host.Start(); } btnStart.Enabled = false; btnStop.Enabled = true; tabControl1.SelectedIndex = 1; }
private static void StartByConfig(ServerOption option) { // 启动 HTTP Server HostInstance = new ServerHost(); HostInstance.Run(option); }
static void Main(string[] args) { ServerHost.Run("http://localhost:23333"); Console.ReadLine(); }