Example #1
0
        static void Main(string[] args)
        {
            var serviceProvider = new ServiceCollection()
                                  .AddInfrastructure()
                                  .BuildServiceProvider();

            var server = new global::Grpc.Core.Server
            {
                Services = { ProductionLineService.BindService(new ProductionLineImpl(serviceProvider)) },
                Ports    = { new ServerPort("localhost", Port, ServerCredentials.Insecure) }
            };

            server.Start();

            Console.WriteLine("Production Line server listening on port " + Port);
            Console.WriteLine("Press any key to stop the server...");
            Console.ReadKey();

            server.ShutdownAsync().Wait();
        }