windows-services

System.Diagnostics.Process.Start() cannot start process when called from Windows service

末鹿安然 提交于 2019-12-19 08:41:32
问题 I am trying to start an external process from a .NET Windows service. In the past I have used the Process.Start() overload that takes the executable path and a command line string. This works. But now I would like to start the process and have it run in the context of a particular user. So I call this version of Start() public static Process Start( string fileName, string userName, SecureString password, string domain) However, when I call the method, the application I am trying to run

C# Windows service self terminate service

血红的双手。 提交于 2019-12-19 07:32:04
问题 How do you have a service self terminate? Environment.Exit will cause the app to start but the service stays running. Any idea? 回答1: You can use the SCM to shut down your service from within the service itself: System.ServiceProcess.ServiceController svc = new System.ServiceProcess.ServiceController("NameOfYourService"); svc.Stop(); Edit: The other option is to call ServiceBase.Stop() in your service - if you have access to your ServiceBase derived class instance that would be the cleaner way

C# Windows service self terminate service

僤鯓⒐⒋嵵緔 提交于 2019-12-19 07:31:52
问题 How do you have a service self terminate? Environment.Exit will cause the app to start but the service stays running. Any idea? 回答1: You can use the SCM to shut down your service from within the service itself: System.ServiceProcess.ServiceController svc = new System.ServiceProcess.ServiceController("NameOfYourService"); svc.Stop(); Edit: The other option is to call ServiceBase.Stop() in your service - if you have access to your ServiceBase derived class instance that would be the cleaner way

Why call base.OnStop() when Windows Service is stopped?

二次信任 提交于 2019-12-19 05:20:37
问题 I'm creating a C#.Net Windows Service and am wondering if you always have to call base.OnStop(); in the service's OnStop() method and why? protected override void OnStop() { threadRunning = false; this.ExitCode = 0; base.OnStop(); } 回答1: From the documentation on ServiceBase.OnStop: OnStop is expected to be overridden in the derived class. For the service to be useful, OnStart and OnStop should both be implemented in your service class. So it's really used as a notification to your service

Clarification on Windows Service Recovery Actions Settings

岁酱吖の 提交于 2019-12-19 05:12:10
问题 I am looking at the recovery actions settings and there are a couple of things that I need clarified. If I have 0 days as my reset fail count after, and have the following as my actions: Restart the Service - on first failure Restart the Service - on second failure Reboot the Computer - on subsequent failures Does the fail count get reset on a successful restart of the service? Does the fail count get reset on the first failure? Hence never having a chance to perform the second or third

Login method Customization using GINA

 ̄綄美尐妖づ 提交于 2019-12-19 05:08:14
问题 I know it's not easy to find a master in GINA, but my question is most near to Interprocess Communication(IPC), I wrote my custom GINA in unmanaged c++, I included it a method that checks for validity of a fingerprint for the user try to login, this function will call some method in a running system windows service written in c#, the code follows: in GINA, unmanaged c++ if(Fingerprint.Validate(userName,finerprintTemplate) { //perform login } in windows service, C# public class Fingerprint {

Raising Custom Class Events In Windows Service C#

你说的曾经没有我的故事 提交于 2019-12-19 04:09:14
问题 I did write a windows service that can connect to a network device using a dll. so everything works fine, but The event handler does not work in win service! here is my code : My Custom Class Code : using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace MyNewService { public class zkemkeeperHandler { public event EventHandler OnFinger; public event EventHandler<VerifyEventArgs> OnVerify; private System.Diagnostics.EventLog eventLog1 = new System

Migration of Traditional Windows Service to Service Fabric

假如想象 提交于 2019-12-19 04:05:31
问题 I'm kicking the tires on the preview release of Service Fabric for Windows Servers found here: Create and manage a cluster running on Windows Server We are trying to solve the problem of the perception of too many Windows services to manually manage, contemplating infrastructures that would make the services more automatically managed. We currently run on-premises, so we are looking at Service Fabric for Windows Servers, not Service Fabric on Azure. I have a native Windows service (Windows NT

Can't install Tomcat 7 as a Service in Windows

北城余情 提交于 2019-12-19 04:01:38
问题 I'm trying to install tomcat as a service in Windows Server 2008. I searched in stackoverflow and can't find any answer to this problem, i can see other related questions which all of them are not the same ( are related to code error 0, mine is code error 1 ) or have not valid answers, so i decided to create this question. I'm using this to create the service: https://tomcat.apache.org/tomcat-7.0-doc/windows-service-howto.html#Installing_services tomcat7 //IS//Tomcat7 --DisplayName="Apache

Can't install Tomcat 7 as a Service in Windows

微笑、不失礼 提交于 2019-12-19 04:01:17
问题 I'm trying to install tomcat as a service in Windows Server 2008. I searched in stackoverflow and can't find any answer to this problem, i can see other related questions which all of them are not the same ( are related to code error 0, mine is code error 1 ) or have not valid answers, so i decided to create this question. I'm using this to create the service: https://tomcat.apache.org/tomcat-7.0-doc/windows-service-howto.html#Installing_services tomcat7 //IS//Tomcat7 --DisplayName="Apache