Esempio n. 1
0
        protected override void Create()
        {
            ConnectionStringHolder.Initialize(Contexts.ApplicationContext.Config.ConnectionString);
            StoreKeeperServer.Create();
            Contexts.ServiceContext.Initialize();

            IServiceDescriptor serviceDescriptor = new ServiceConfiguration();

            string uriApplication = Infrastructure.GetEndpointUrl(serviceDescriptor);

            _applicationHost = new ServiceHost(typeof(StoreKeeperContract), new Uri(uriApplication));
            Infrastructure.AddServiceBehaviors(_applicationHost.Description);

            _applicationHost.AddServiceEndpoint(
                typeof(IServerAccess),
                Infrastructure.CreateApplicationBinding(false),
                Constants.ServiceAccessContract
                );

            _applicationHost.Open();

            Logger.Info("StoreKeeperService started on address: {0}", uriApplication);

            Contexts.ServiceContext.SessionManager.ReconnectSessions();
        }
Esempio n. 2
0
        protected override Binding CreateBinding(bool secured)
        {
            Binding binding = Infrastructure.CreateApplicationBinding(false);

            binding.SendTimeout    = TimeSpan.FromMinutes(Constants.DefaultProxyTimeoutInMinutes);
            binding.ReceiveTimeout = TimeSpan.FromMinutes(Constants.DefaultProxyTimeoutInMinutes);
            return(binding);
        }
        private void CreateClientHost()
        {
            IServiceDescriptor clientDescriptor = new ClientConfiguration(_clientConfiguration.ClientPort);
            string             uriClient        = Infrastructure.GetEndpointUrl(clientDescriptor);

            _contractInstance = new ClientContract(_infrastructureCallback, CheckClient);

            _clientHost = new ServiceHost(_contractInstance, new Uri(uriClient));

            Infrastructure.AddServiceBehaviors(_clientHost.Description);

            _clientHost.AddServiceEndpoint(
                typeof(IClientInfrastructure),
                Infrastructure.CreateApplicationBinding(false),
                Constants.ClientAccessContract
                );

            _clientHost.Open();
        }