Esempio n. 1
0
        static void Main(string[] args)
        {
            StructureMapServiceHost sh = new StructureMapServiceHost(typeof(Dispatcher));

            sh.Open();

            ChannelFactory <IDispatcher> channelFactory = new ChannelFactory <IDispatcher>("*");

            var requestProcessor = channelFactory.CreateChannel();

            requestProcessor.Send(new CreateInventoryItemCommand());

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

            sh.Close(new TimeSpan(0, 0, 1));
        }
Esempio n. 2
0
        public static void Main(string[] args)
        {
            InitializeContainer();

            string baseAddress = "http://localhost:9000/calculator";

            using (ServiceHost serviceHost = new StructureMapServiceHost(typeof(Calculator), new Uri(baseAddress)))
            {
                serviceHost.Open();

                Console.WriteLine("Service up and running at:");
                foreach (var endpoint in serviceHost.Description.Endpoints)
                {
                    Console.WriteLine(endpoint.Address);
                }
                Console.WriteLine("Press any key to close.");

                Console.ReadLine();

                serviceHost.Close();
            }
        }