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(); }
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(); }