protected override void OnStart(string[] args) { try { var server = new ThriftSServer(); int port = int.Parse(System.Configuration.ConfigurationManager.AppSettings["RegServerPort"]); server.Start(false, port); Log.Debug(string.Format("{0}注册机服务已经启动,端口{1}", DateTime.Now, port)); } catch (Exception ex) { Console.WriteLine("服务启动失败"); //Console.WriteLine(ex); Log.Error(ex.Message); } }
static void Main(string[] args) { try { var server = new ThriftSServer(); server.Start(false, int.Parse(System.Configuration.ConfigurationManager.AppSettings["RegServerPort"])); Console.WriteLine("{0}注册机服务已经启动", DateTime.Now); Console.ReadLine(); server.Stop(); Console.ReadLine(); } catch (Exception ex) { Console.WriteLine("服务启动失败"); Console.WriteLine(ex); Console.ReadLine(); } }
static void Main(string[] args) { try { ThriftSEnvirnment.Logger = new MyThriftSLogger(); var server = new ThriftSServer(); server.Start(); Console.ReadLine(); server.Stop(); Console.ReadLine(); } catch (Exception ex) { Console.WriteLine(ex); Console.ReadLine(); } }
static void Main(string[] args) { try { ThriftSEnvirnment.Logger = new MyThriftSLogger(); var server = new ThriftSServer(); // server.RegisterService(typeof(IEmployeeService), typeof(EmployeeService)); server.Start(); Console.ReadLine(); server.Stop(); Console.ReadLine(); } catch (Exception ex) { Console.WriteLine("服务启动失败"); Console.WriteLine(ex); Console.ReadLine(); } }