Esempio n. 1
0
        private async Task RunAsync()
        {
            string ip   = "0.0.0.0";
            int    port = this._option.Port;

            var host = new RpcHostBuilder()
                       .UseServer(ip, port)
                       .UseStartup <QpsServerStartup>()
                       .Build();
            await host.StartAsync();

            Console.WriteLine("Running qps worker server on " + string.Format("{0}:{1}", ip, port));
            Console.ReadKey();
            await host.ShutdownAsync();

            Console.WriteLine("server is Shutdown");
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            Console.OutputEncoding = System.Text.Encoding.UTF8;

            NLoggerWrapper.InitConfig();
            DotBPE.Rpc.Environment.SetLogger(new NLoggerWrapper(typeof(Program)));

            var host = new RpcHostBuilder()
                       .UseStartup <Startup>()
                       .Build();

            host.StartAsync().Wait();

            Console.WriteLine("Press any key to quit!");
            Console.ReadKey();

            host.ShutdownAsync().Wait();
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            //DotBPE.Rpc.Environment.SetLogger(new DotBPE.Rpc.Logging.ConsoleLogger());

            string ip   = "127.0.0.1";
            int    port = 6201;

            var host = new RpcHostBuilder()
                       .UseServer(ip, 6201)
                       .UseStartup <ServerStartup>()
                       .Build();

            host.StartAsync().Wait();
            Console.WriteLine("running server on {0}:{1}", ip, port);
            Console.WriteLine("press any key to shutdown");
            Console.ReadKey();

            host.ShutdownAsync().Wait();
            Console.WriteLine("server is shutdown");
        }
Esempio n. 4
0
        static void Main(string[] args)
        {
            DotBPE.Rpc.Environment.SetLogger(new DotBPE.Rpc.Logging.ConsoleLogger());

            // 启动HTTP服务
            var urls    = "http://127.0.0.1:6200";
            var webHost = new WebHostBuilder()
                          .UseKestrel()
                          .UseUrls(urls)
                          .UseStartup <Startup>()
                          .Build();

            webHost.StartAsync().Wait();

            Console.WriteLine("running http server listen {0}", urls);

            // RPC Server
            string ip   = "127.0.0.1";
            int    port = 6201;

            var rpcHost = new RpcHostBuilder()
                          .UseServer(ip, 6201)
                          .UseStartup <DotBPEStartup>()
                          .Build();

            rpcHost.StartAsync().Wait();
            Console.WriteLine("running server on {0}:{1}", ip, port);
            Console.WriteLine("press any key to shutdown");
            Console.ReadKey();

            webHost.StopAsync().Wait();
            Console.WriteLine("http server is shutdown");

            rpcHost.ShutdownAsync().Wait();
            Console.WriteLine("dotbpe server is shutdown");
        }