Пример #1
0
        public FilesWinService(ILog log, IDeaConfig config, IFirewallService firewallService) : base(log, true)
        {
            this.config          = config;
            this.firewallService = firewallService;

            Uri baseAddress = config.FilesServiceUri;

            var webHttpBinding = new WebHttpBinding();

            webHttpBinding.Security.Mode = WebHttpSecurityMode.TransportCredentialOnly;
            webHttpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;

            var serviceHost = new IocServiceHost(typeof(FilesService), baseAddress);

            base.serviceHost = serviceHost;

            ServiceEndpoint endpoint = serviceHost.AddServiceEndpoint(typeof(IFilesService), webHttpBinding, baseAddress);

            endpoint.Behaviors.Add(new WebHttpBehavior());
            ServiceCredential filesCredentials = config.FilesCredentials;

#if DEBUG
            log.Debug("FilesWinService baseAddress: {0} credentials: {1}:{2}",
                      baseAddress, filesCredentials.Username, filesCredentials.Password);
#endif
            serviceHost.Credentials.UserNameAuthentication.CustomUserNamePasswordValidator = new CustomUserNamePasswordValidator(filesCredentials);
            serviceHost.Credentials.UserNameAuthentication.UserNamePasswordValidationMode  = UserNamePasswordValidationMode.Custom;
        }
Пример #2
0
        protected override void OnStart(string[] args)
        {
            var provider = Startup.GetProvider();

            Startup.EnsureDatabaseExistance(provider);

            _municipalityTaxHost = new IocServiceHost(provider, typeof(MunicipalityTaxManager));
            _municipalityTaxHost.Open();
        }
        static void Main(string[] args)
        {
            var provider = Startup.GetProvider();

            Startup.EnsureDatabaseExistance(provider);

            var MunicipalityTaxHost = new IocServiceHost(provider, typeof(MunicipalityTaxManager));

            MunicipalityTaxHost.Open();

            Console.WriteLine("The host is listening on http://localhost:8733/Design_Time_Addresses/MunicipalityTaxs/");
            Console.ReadLine();

            MunicipalityTaxHost.Close();
        }
        public MonitoringWinService(ILog log, IConfig config, IFirewallService firewallService) : base(log, true)
        {
            this.config          = config;
            this.firewallService = firewallService;

            Uri baseAddress = config.MonitoringServiceUri;

            var webHttpBinding = new WebHttpBinding();

            webHttpBinding.Security.Mode = WebHttpSecurityMode.TransportCredentialOnly;
            webHttpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;
            var serviceHost = new IocServiceHost(typeof(MonitoringService), baseAddress);

            base.serviceHost = serviceHost;

            ServiceEndpoint endpoint = serviceHost.AddServiceEndpoint(typeof(IMonitoringService), webHttpBinding, baseAddress);

            endpoint.Behaviors.Add(new WebHttpBehavior());
            serviceHost.Credentials.UserNameAuthentication.CustomUserNamePasswordValidator = new CustomUserNamePasswordValidator(config.MonitoringCredentials);
            serviceHost.Credentials.UserNameAuthentication.UserNamePasswordValidationMode  = UserNamePasswordValidationMode.Custom;
        }