Ejemplo n.º 1
0
        protected override void OnStart(string[] args)
        {
            FileLog.Initialize(ServiceName);
            string serviceAssembly   = AppConfigurationHelper.GetConfiguration("ServiceAssembly");
            string serviceType       = AppConfigurationHelper.GetConfiguration("ServiceType");
            string InterfaceAssembly = AppConfigurationHelper.GetConfiguration("InterfaceAssembly");
            string InterfaceType     = AppConfigurationHelper.GetConfiguration("InterfaceType");
            string baseUri           = AppConfigurationHelper.GetConfiguration("BaseUri");
            string mexUri            = AppConfigurationHelper.GetConfiguration("MexUri");

            _host = CreateServiceHost(
                serviceAssembly,
                serviceType,
                InterfaceAssembly,
                InterfaceType,
                baseUri,
                mexUri);
            try
            {
                _host.Open();
            }
            catch (Exception e)
            {
                string message = string.Format("Error starting service {0}", ServiceName);
                FileLog.Fatal(message, e);
                throw;
            }

            FileLog.Info(string.Format("Service {0} started. Address: {1}.", ServiceName, baseUri));
        }
Ejemplo n.º 2
0
 public WindowsServiceHost()
 {
     ServiceName = AppConfigurationHelper.GetConfiguration("ServiceContractName");
 }