public static void Main(string[] args) { GrpcEnvironment.SetLogger(new ConsoleLogger()); const int Port = 5000; var weatherImpl = new WeatherImpl(new WeatherService()); var userImpl = new UserImpl(new UserService()); var pingImpl = new PingImpl(); Server server = new Server { Services = { Weathers.BindService(weatherImpl).Intercept(new AuthInterceptor()), Check.BindService(pingImpl), Users.BindService(userImpl) }, Ports = { new ServerPort("0.0.0.0", Port, ServerCredentials.Insecure) } }; server.Start(); GrpcEnvironment.Logger.Info("[START] Tozawa server listening on port " + Port); GrpcEnvironment.Logger.Info("[Other] Press any key to stop the server..."); Console.Read(); server.ShutdownAsync().Wait(); }
public static void Main(string[] args) { const int Port = 5000; var weatherImple = new WeatherImpl(new WeatherService()); Server server = new Server { Services = { Weathers.BindService(weatherImple) }, Ports = { new ServerPort("0.0.0.0", Port, ServerCredentials.Insecure) } }; server.Start(); Console.WriteLine("starting server ..."); Console.Read(); server.ShutdownAsync().Wait(); }
public static void Main(string[] args) { const int Port = 5000; var weatherImpl = new WeatherImpl(new WeatherService()); Server server = new Server { Services = { Weathers.BindService(weatherImpl) }, Ports = { new ServerPort("0.0.0.0", Port, ServerCredentials.Insecure) } }; server.Start(); Console.WriteLine("Tozawa server listening on port " + Port); Console.WriteLine("Press any key to stop the server..."); Console.ReadKey(); server.ShutdownAsync().Wait(); // configuration = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()).AddJsonFile(@"appsettings.json", false).Build(); // sqlHandler = new SqlHandler(); // CreateWebHostBuilder(args).Build().Run(); }