static void Main(string[] args) { Console.Title = typeof(Program).Namespace; // 用于提供静态html页面,也可以用IIS var httpServer = new HttpServer(); httpServer.StartListen(82); Console.WriteLine("http服务启动成功 .."); // 当浏览器不支持websocket时,将由flash实现 var flexPolicyServer = new FlexPolicyServer(); flexPolicyServer.StartListen(); Console.WriteLine("flex策略服务启动成功 .."); // websocket服务 var webSocketServer = new ChatWebSocketServer(); webSocketServer.StartListen(83); Console.WriteLine("WebSocket服务启动成功 .."); // 设置进程的工作目录 if (Directory.Exists("js") == false) { Directory.SetCurrentDirectory("../../"); } Process.Start("http://localhost:82/index.html"); Console.ReadLine(); }
static void Main(string[] args) { // http服务 用于提供静态html页面(也可以用IIS) var http = new HttpServer(); http.StartListen(82); // websocket服务 var webSocket = new ChatWebSocketServer(); webSocket.GlobalFilter.Add(new ExceptionFilter()); // 异常处理 webSocket.BindService<ChatService>(); // 关联服务 webSocket.StartListen(83); Console.WriteLine("http服务启动成功 .."); Process.Start("http://localhost:82/index.html"); Console.ReadLine(); }