public static void Main() { using (var container = new UnityContainer()) using (var host = new UnityServiceHost(container, typeof(DebugService), new Uri(SharedConfiguration.WCFDebugServiceLocation))) { DebugModule.ConfigureContainer(container); OpenHost(host); Console.WriteLine("WCF host is listening {0}", host.BaseAddresses.First()); Console.WriteLine("Press enter to exit..."); Console.ReadLine(); } }
public static async Task Main(string[] args) { var container = new UnityContainer(); DebugModule.ConfigureContainer(container); var server = new Server { Ports = { new ServerPort("localhost", SharedConfiguration.NativegRPCDebugServicePort, ServerCredentials.Insecure) } }; server.Services.AddServiceModelTransient( container.Resolve <Func <DebugService> >(), options => { // register server error handler options.ErrorHandler = container.Resolve <IServerErrorHandler>(); }); 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(); }
public void ConfigureContainer(IUnityContainer container) { // configure container DebugModule.ConfigureContainer(container); }