/// <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 service = KernelContainer.Kernel.Get<ITimeService>();
     _host = new NinjectServiceHost( service );
     _host.AddServiceEndpoint( typeof (ITimeService), new NetTcpBinding(), "net.tcp://localhost/TimeService" );
     _host.Open();
 }
示例#2
0
文件: server.cs 项目: arunappulal/all
    public static void Main(string[] args)
    {
        var modules = new INinjectModule[] { new DomasNinjectModule() };
        KernelContainer.Kernel = new StandardKernel(modules);

        var binding = new BasicHttpBinding();
        var address = new Uri("http://127.0.0.1:8888");
        var host = new NinjectServiceHost(typeof(DomasService));
        host.AddServiceEndpoint(typeof(IDomasService), binding, address);
        host.Open();
        Console.WriteLine("Press enter to stop..");
        Console.ReadLine();
        host.Close();
    }