public void Stop() { try { if (filehost != null) { filehost.Close(); } } catch (Exception ex) { throw ex; } try { if (wcfhost != null) { wcfhost.Close(); } } catch (Exception ex) { throw ex; } }
protected override void OnStart(string[] args) { if (host != null) { host.Close(); host = null; } host = new XServiceHost(typeof(SGM.ECountJQ.UPG.Service.Service)); host.Open(); }
private void StopService() { if (host != null) { host.Close(); } btn_start.Enabled = true; btn_stop.Enabled = false; lbl_message.Text = "Service Stopped"; }
public void Stop() { try { if (host != null) { host.Close(); } } catch (Exception ex) { throw ex; } }
/// <summary> /// Closes the service host. /// </summary> /// <param name="serviceHost">The service host.</param> private static void CloseServiceHost(System.ServiceModel.ServiceHost serviceHost) { if (serviceHost != null) { serviceHost.Close(); } }
protected override void OnStop() { if (host != null) { host.Close(); } }
public virtual void Close() { if (_Host != null) { _Host.Close(); } }
protected override void OnStart(string[] args) { try { if (ServiceHost != null) { ServiceHost.Close(); } ServiceHost = new System.ServiceModel.ServiceHost(typeof(Service1)); ServiceHost.Open(); } catch (Exception ex) { throw ex; } }
static void Main(string[] args) { System.ServiceModel.ServiceHost objServiceHost = null; try { objServiceHost = new System.ServiceModel.ServiceHost(typeof(Service)); objServiceHost.Open(); Console.WriteLine("Listening... <press enter to stop>"); Console.ReadLine(); } catch (Exception e) { Console.WriteLine("Error:"); Console.WriteLine(e.ToString()); Console.ReadLine(); } finally { try { if (objServiceHost != null) objServiceHost.Close(); } catch { } } }
protected override void OnStop() { try { base.OnStop(); watcher.EnableRaisingEvents = false; timer.Enabled = false; host.Close(); EventLog.WriteEntry("Сервис остановлен", EventLogEntryType.Information, (int)EventID.Stop); } catch (Exception ex) { WriteException(ex); } }
static void Main(string[] args) { var host = new System.ServiceModel.ServiceHost(typeof(UserInfo)); host.Open(); Console.WriteLine("http://localhost:8028/UserInfo"); Console.ReadLine(); host.Close(); }
public void Close() { if (_host != null && _host.State == System.ServiceModel.CommunicationState.Opened) { _host.Close(); } else { WriteLog("Wcf服务未启动!"); } }
private void btnQuit_Click(System.Object sender, System.EventArgs e) { taskbarIcon.Dispose(); if ((hostIDBrowserService != null)) { if (hostIDBrowserService.State == System.ServiceModel.CommunicationState.Opened) { hostIDBrowserService.Close(); } } Application.Current.Shutdown(); }
static void Main(string[] args) { //using (var sh = new System.ServiceModel.ServiceHost(typeof(LocalService))) using (var sh = new System.ServiceModel.ServiceHost(typeof(ServiceDuplex))) { Console.WriteLine("openning..."); sh.Open(); Console.WriteLine("ready"); Console.ReadLine(); Console.WriteLine("closing..."); sh.Close(); } }
static void Main(string[] args) { System.ServiceModel.ServiceHost host = new System.ServiceModel.ServiceHost(typeof(WCFServer.Service) /*, * new Uri[] { new Uri("http://localhost:8080/LeakingService")}*/); host.Open(); System.Console.WriteLine("Server listening"); Service.s_ev.WaitOne(); host.Close(); System.Console.WriteLine("Server closed"); }
static void Main(string[] args) { var selfHost = new System.ServiceModel.ServiceHost(typeof(QualityBotService)); selfHost.Open(); Console.WriteLine("QualityBotService is up and running with the following endpoints:"); foreach (ServiceEndpoint se in selfHost.Description.Endpoints) { Console.WriteLine(se.Address.ToString()); } Console.ReadLine(); selfHost.Close(); }
static void Main(string[] args) { //Najprostsza z możliwych inicjalizacja serwera var host = new System.ServiceModel.ServiceHost(typeof(MessageService)); host.Open(); var host2 = new System.ServiceModel.ServiceHost(typeof(MessageService2)); host2.Open(); //Nieistotne host.Description.Endpoints.ToList().ForEach((endpoint) => Console.WriteLine(endpoint.ListenUri)); host2.Description.Endpoints.ToList().ForEach((endpoint) => Console.WriteLine(endpoint.ListenUri)); Console.WriteLine("Please enter to exit"); Console.ReadLine(); host.Close(); }
static void Main(string[] args) { try { log4net.Config.XmlConfigurator.Configure(); // Create container IWindsorContainer container = new WindsorContainer(); // Add Engine for the Host Service container.AddComponent("outfitEngineService", typeof(OutfitEngineService)); container.AddComponent("outfitUpdaterService", typeof(OutfitUpdaterService)); // Add the Services to the Container ComponentRegistrar.AddServicesTo(container); ComponentRegistrar.AddApplicationServicesTo(container); // Create the container ServiceLocatorInitializer.Init(container); // Initialize NHibernate NHibernateInitializer.Instance().InitializeNHibernateOnce( () => InitializeNHibernateSession()); System.ServiceModel.ServiceHost host = new System.ServiceModel.ServiceHost(typeof(OutfitEngineService)); host.Description.Behaviors.Add(new PerCallServiceBehavior()); host.Open(); ServiceHost host2 = new ServiceHost(typeof(OutfitUpdaterService)); host2.Open(); Console.WriteLine("Service started..."); Console.ReadLine(); host.Close(); host2.Close(); Console.WriteLine("Service stopped..."); Console.ReadLine(); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }
static void Main(string[] args) { var sharedSecretServiceBusCredential = new TransportClientEndpointBehavior(); var serviceNamespace = "msswit2013relay"; var issuerName = "owner"; var issuerSecret = "IqyIwa7gNjBO89HT+3Vd1CcoBbyibvcv6Hd92J+FtPg="; sharedSecretServiceBusCredential.TokenProvider = TokenProvider.CreateSharedSecretTokenProvider( issuerName, issuerSecret); Uri address = ServiceBusEnvironment.CreateServiceUri( "sb", serviceNamespace, "Service"); ServiceBusEnvironment.SystemConnectivity.Mode = ConnectivityMode.AutoDetect; var host = new System.ServiceModel.ServiceHost( typeof(Service), address); IEndpointBehavior serviceRegistrySettings = new ServiceRegistrySettings(DiscoveryType.Public); foreach (ServiceEndpoint endpoint in host.Description.Endpoints) { endpoint.Behaviors.Add(serviceRegistrySettings); endpoint.Behaviors.Add(sharedSecretServiceBusCredential); } host.Open(); Console.WriteLine("Service address: " + address); Console.WriteLine("Press [Enter] to close"); Console.ReadLine(); host.Close(); }
public void Stop() { switch (_svc_hosts_type) { case ServiceHostType.soap: if (_soap_service_host != null) { _soap_service_host.Close(); } break; case ServiceHostType.web: if (_web_service_host != null) { _web_service_host.Close(); } break; } }
public static void Main(string[] args) { System.ServiceModel.ServiceHost hostReload = new System.ServiceModel.ServiceHost(typeof(ReloadWS.Service.ReloadService)); System.ServiceModel.ServiceHost hostAuthenticationService = new System.ServiceModel.ServiceHost(typeof(ReloadWS.Service.AuthenticationService)); //System.ServiceModel.ServiceHost hostPostService = new System.ServiceModel.ServiceHost(typeof(ReloadWS.Service.PostService)); try { hostReload.Open(); hostAuthenticationService.Open(); Console.Read(); } catch (Exception ex) { Security.Logs.grabar(ex); } finally { hostReload.Close(); hostAuthenticationService.Close(); } }
static void Main(string[] args) { try { Uri storageBaseAddress = new Uri("http://localhost:8080/s3storageGateway"); Uri preBaseAddress = new Uri("http://localhost:8080/s3pre"); Logger.Initialize(); Logger.LogInfo("ServiceHost is starting..."); if (WinSecurity.IsVistaOrHigher() && !WinSecurity.IsAdmin()) { Console.WriteLine("This application requires administrator rights to work"); Console.WriteLine("Press any key to restart the application with administrative rights, or close the program to exit..."); Console.ReadKey(); Logger.LogInfo("Restarting process as admin"); WinSecurity.RestartElevated(); return; } System.ServiceModel.ServiceHost storageHost = new System.ServiceModel.ServiceHost(typeof(StorageService), storageBaseAddress); ServiceMetadataBehavior smb = new ServiceMetadataBehavior(); smb.HttpGetEnabled = true; smb.MetadataExporter.PolicyVersion = PolicyVersion.Policy15; storageHost.Description.Behaviors.Add(smb); // Add application endpoint storageHost.AddServiceEndpoint(ServiceMetadataBehavior.MexContractName, MetadataExchangeBindings.CreateMexHttpBinding(), "mex"); storageHost.AddServiceEndpoint(typeof(IGatewayService), ProxyFactory.CreateBinding(), ""); System.ServiceModel.ServiceHost preHost = new System.ServiceModel.ServiceHost(typeof(PreService), preBaseAddress); smb = new ServiceMetadataBehavior(); smb.HttpGetEnabled = true; smb.MetadataExporter.PolicyVersion = PolicyVersion.Policy15; preHost.Description.Behaviors.Add(smb); // Add application endpoint preHost.AddServiceEndpoint(ServiceMetadataBehavior.MexContractName, MetadataExchangeBindings.CreateMexHttpBinding(), "mex"); preHost.AddServiceEndpoint(typeof(IPreService), ProxyFactory.CreateBinding(), ""); preHost.Open(); storageHost.Open(); Logger.LogInfo("ServiceHosts are ready..."); Console.WriteLine("The storage services is ready at {0}", storageBaseAddress); Console.WriteLine("The pre services is ready at {0}", preBaseAddress); Console.WriteLine("Press <Enter> to stop the services."); Console.ReadKey(); Console.WriteLine(); Logger.LogInfo("ServiceHosts are closing..."); preHost.Close(); storageHost.Close(); Console.WriteLine("Services have been closed"); } catch (Exception e) { Console.WriteLine("Error hosting services. See log for details."); Logger.LogError("Unhandled exception in service hoster", e); } Console.WriteLine("Press a key to exit"); Console.ReadKey(); }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { host.Close(); }
private static void CloseHost() { _host?.Close(); }
protected override void OnStop() { _host.Close(); }
private void MainForm_FormClosed(object sender, FormClosedEventArgs e) { m_Host.Close(); }
static void Main(string[] args) { //using (var db = new LnkdDataModel()) //{ // Console.WriteLine("--- Creating a new User ---"); // Console.Write("- Username : "******"- Password : "******"DB Saved successfully !"); //} //Console.WriteLine("Press any key to exit ..."); //Console.ReadKey(); using (var ctx = new LnkdDataModel()) { DevelopperProfile pr = new DevelopperProfile() { FirstName = "DevProfil", LastName = "DevProfil", }; ctx.DevelopperProfiles.Add(pr); ProjectChiefProfile pc = new ProjectChiefProfile() { FirstName = "ProjectChiefProfil", LastName = "ProjectChiefProfil", }; ctx.ProjectChiefProfiles.Add(pc); Project p = new Project() { Name = "Projet A", ProjectChief = pc }; p.ProposedProfiles.Add(pr); p.ProposedProfiles.Add(pc); ctx.Projects.Add(p); ctx.SaveChanges(); } System.ServiceModel.ServiceHost loginServiceHost = new System.ServiceModel.ServiceHost(typeof(LoginService)); loginServiceHost.Open(); Console.WriteLine("Login Service Started..."); System.ServiceModel.ServiceHost profileServiceHost = new System.ServiceModel.ServiceHost(typeof(ProfilService)); profileServiceHost.Open(); Console.WriteLine("Profile Service Started..."); System.ServiceModel.ServiceHost projectServiceHost = new System.ServiceModel.ServiceHost(typeof(ProjectService)); projectServiceHost.Open(); Console.WriteLine("Project Service Started..."); Console.ReadKey(); loginServiceHost.Close(); profileServiceHost.Close(); Console.WriteLine("Service(s) closed."); }
protected override void OnStop() { _serviceHost.Close(); Logger.Info("GwupeService" + BuildMarker + " Shutting Down"); WriteEventLog("Shutting down GwupeService" + BuildMarker); }
/// <summary> /// do some housekeeping /// </summary> /// <param name="host"></param> /// <param name="serviceDescription"></param> private static void StopService(System.ServiceModel.ServiceHost host, string serviceDescription) { host.Close(); System.Console.WriteLine("Service {0} stopped.", serviceDescription); }
protected override void OnStop() { serviceHost.Close(); writeLog("Close"); }