Exemplo n.º 1
0
        public static async Task Main(string[] args)
        {
            var container = new UnityContainer();

            PersonModule.ConfigureContainer(container);

            var server = new Server
            {
                Ports =
                {
                    new ServerPort("localhost", SharedConfiguration.NativegRPCPersonServicePort, ServerCredentials.Insecure)
                }
            };

            server.Services.AddServiceModelTransient(container.Resolve <Func <PersonService> >());

            try
            {
                server.Start();

                Console.WriteLine("gRPC host is listening http:/localhost:{0}", server.Ports.First().Port);
                Console.WriteLine("Press enter to exit...");
                Console.ReadLine();
            }
            finally
            {
                await server.ShutdownAsync();
            }

            Console.WriteLine("Press enter for exit...");
            Console.ReadLine();
        }
Exemplo n.º 2
0
        public static void Main()
        {
            using (var container = new UnityContainer())
                using (var host = new UnityServiceHost(container, typeof(PersonService), new Uri(SharedConfiguration.WCFPersonServiceLocation)))
                {
                    PersonModule.ConfigureContainer(container);
                    OpenHost(host);

                    Console.WriteLine("WCF host is listening {0}", host.BaseAddresses.First());
                    Console.WriteLine("Press enter to exit...");
                    Console.ReadLine();
                }
        }
Exemplo n.º 3
0
 public void ConfigureContainer(IUnityContainer container)
 {
     // configure container
     PersonModule.ConfigureContainer(container);
 }