Esempio n. 1
0
        /// <summary>
        ///     When implemented in a derived class, executes when a Start command
        ///     is sent to the service by the Service Control Manager (SCM) or when
        ///     the operating system starts (for a service that starts
        ///     automatically). Specifies actions to take when the service starts.
        /// </summary>
        /// <param name="args">Data passed by the start command.</param>
        protected override void OnStart(string[] args)
        {
            var serviceComfiguration =
                NinjectWcfConfiguration.Create <UppyDataManagerService, NinjectServiceSelfHostFactory>();

            selfHost = new NinjectSelfHostBootstrapper(
                CreateKernel,
                serviceComfiguration);
            selfHost.Start();
        }
        /// <summary>
        /// When implemented in a derived class, executes when a Start command
        /// is sent to the service by the Service Control Manager (SCM) or when
        /// the operating system starts (for a service that starts
        /// automatically). Specifies actions to take when the service starts.
        /// </summary>
        /// <param name="args">Data passed by the start command.</param>
        protected override void OnStart(string[] args)
        {
            var timeServiceComfiguration    = NinjectWcfConfiguration.Create <TimeService, NinjectServiceSelfHostFactory>();
            var timeWebServiceComfiguration = NinjectWcfConfiguration.Create <TimeWebService, NinjectWebServiceSelfHostFactory>();

            this.selfHost = new NinjectSelfHostBootstrapper(
                CreateKernel,
                timeServiceComfiguration,
                timeWebServiceComfiguration);
            this.selfHost.Start();
        }
Esempio n. 3
0
 private void StartService()
 {
     lock (_lockObject)
     {
         var uplodService = NinjectWcfConfiguration.Create <ExcelUploadService, NinjectServiceSelfHostFactory>();
         var selfHost     = new NinjectSelfHostBootstrapper(
             CreateKernel,
             uplodService);
         Console.Write($"Starting the service {uplodService.BaseAddresses.SingleOrDefault()}");
         selfHost.Start();
     }
 }
Esempio n. 4
0
        static void Main(string[] args)
        {
            IKernel kernel = new StandardKernel(new ServiceModule());

            NinjectWcfConfiguration dollarConverterServiceConfig =
                NinjectWcfConfiguration.Create <DollarConverterService, NinjectServiceSelfHostFactory>();

            using (var selfHost = new NinjectSelfHostBootstrapper(() => kernel
                                                                  , dollarConverterServiceConfig))
            {
                selfHost.Start();
                Console.Write("All Services Started. Press \"Enter\" to stop thems...");
                Console.ReadLine();
            }
        }
Esempio n. 5
0
 static void Main(string[] args)
 {
     try
     {
         var chatServiceConfiguration = NinjectWcfConfiguration.Create <ChatService, NinjectServiceSelfHostFactory>();
         using (var host = new NinjectSelfHostBootstrapper(CreateKernel, chatServiceConfiguration))
         {
             host.Start();
             Console.ReadKey();
         }
     }
     catch (Exception exception)
     {
         Console.WriteLine(exception);
     }
 }
        private static NinjectSelfHostBootstrapper CreateAndStartTestService(TestServiceConfiguration config, IKernel kernel)
        {
            var binding = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None)
            {
                SendTimeout = TimeSpan.FromSeconds(10)
            };
            var address   = new Uri(BaseUrl, config.Id);
            var wcfConfig = NinjectWcfConfiguration.Create <DefaultTestService, NinjectServiceSelfHostFactory>(
                h => h.AddServiceEndpoint(typeof(ITestService), binding, address));

            var host = new NinjectSelfHostBootstrapper(() => kernel, wcfConfig);

            if (!kernel.GetAll <INinjectSelfHost>().Any())
            {
                throw new TestServiceException("Can't start test service because no instances of `INinjectSelfHost` are registered");
            }
            host.Start();
            return(host);
        }