windows-services

Setting a PHP script as a Windows Service

こ雲淡風輕ζ 提交于 2019-11-27 18:35:49
I need to set up a PHP script as a windows service. I need it to run regardless of which user is logged in, and on system start up - so it sounds like a windows service is best, but am happy to hear other suggestions. (This script runs continuously, it's not a "run every 5 mins" thing I could use the Scheduled Task Manager for.) http://support.microsoft.com/kb/251192 covers using the sc.exe program to install your service. But from what I've read, I need to have a wrapper round the PHP script to accept the special commands from the windows service manager. Can anyone help with this? rodneyrehm

How to Start/Stop a Windows Service from an ASP.NET app - Security issues

假如想象 提交于 2019-11-27 18:12:35
Here's my Windows/.NET security stack: A Windows Service running as LocalSystem on a Windows Server 2003 box. A .NET 3.5 Website running on the same box, under "default" production server IIS settings (so probably as NETWORKSERVICE user?) On my default VS2008 DEV environment I have this one method, which gets called from the ASP.NET app, which works fine: private static void StopStartReminderService() { ServiceController svcController = new ServiceController("eTimeSheetReminderService"); if (svcController != null) { try { svcController.Stop(); svcController.WaitForStatus

Monitor when an exe is launched

浪尽此生 提交于 2019-11-27 18:12:07
I have some services that an application needs running in order for some of the app's features to work. I would like to enable the option to only start the external Windows services to initialize after the application is launched. (as opposed to having them start automatically with the machine and take up memory when the application is not needed) I do not have access to the exe's code to implement this, so ideally I would like to write a C# .Net Windows service that would monitor when an exe is launched. What I've found so far is the System.IO.FileSystemEventHandler. This component only

Upgrade a Windows Service without Uninstalling

孤街浪徒 提交于 2019-11-27 18:09:39
Currently I have to uninstall the old version of my service before I install the new version. I am pretty sure this has something to do with it not being smart enough to update or remove the old service entries before adding the new ones. Is there a way to have the installer skip registering the service if it already exists? (I can assume the installation folder and service name do not change between versions.) Also, is there a way to automatically stop the service when uninstalling? Edit: I am using MSI packages and the Visual Studio setup project. I've done this with WiX, which generates

How to send a custom command to a .NET windows Service from .NET code?

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-27 17:31:33
As in the following link, one can stop, start, and "stop, then start" a service using C# code. http://www.csharp-examples.net/restart-windows-service/ I have baked a .NET service that does implement OnStart and OnStop . However, I need to implement a "smart restart" functionality which is more involved than just stopping and then starting. I need to keep the downtime to just a few seconds if that (but Stop + Start can take minutes in this case when done cleanly, and I must do it cleanly), and having some parts of the system available while others are rebooting/refreshing. Long story short -

Windows Service or Scheduled Task, which one do we prefer?

对着背影说爱祢 提交于 2019-11-27 17:24:25
问题 If we need to write a program that works periodically, which way do we prefer? Writing a windows service or writing a console application which works as scheduled task? 回答1: I would suggest running the process as a scheduled task if you can, and writing a service only if you need to. Services are quite a bit more difficult to write (correctly), and if you're running your process on a schedule of any sort, you're much better off using the windows scheduler than attempting to build a scheduler

UnhandledException handler in a .Net Windows Service

本小妞迷上赌 提交于 2019-11-27 17:14:08
问题 Is it possible to use an UnhandledException Handler in a Windows Service? Normally I would use a custom built Exception Handling Component that does logging, phone home, etc. This component adds a handler to System.AppDomain.CurrentDomain.UnhandledException but as far as I can tell this doesn’t achieve anything win a Windows Service so I end up with this pattern in my 2 (or 4) Service entry points: Protected Overrides Sub OnStart(ByVal args() As String) ' Add code here to start your service.

The type initializer for 'MyClass' threw an exception

徘徊边缘 提交于 2019-11-27 17:08:36
The following is my Windows service code. When I am debugging the code, I am getting the error/ exception: The type initializer for 'CSMessageUtility.CSDetails' threw an exception. using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.Linq; using System.ServiceProcess; using System.Text; using System.IO; using System.Threading; using System.Windows; using System.Windows.Forms; using CSMessageUtility; namespace CS_Data_Trasmmiting_Service { public partial class svcCSWinServ : ServiceBase { //private string

Add nginx.exe as Windows system service (like Apache)?

◇◆丶佛笑我妖孽 提交于 2019-11-27 16:58:13
I set up NGINX as a front end server for static content and I use Apache as a back-end server for other thing. The thing is I can't find a logical answer that allows me to make nginx.exe a Windows system service (like my Apache). Any come across an answer to this? How to do it with Windows Service Wrapper (Note: There are easier alternatives by now - see also solutions described here below using chocolatey package manager by suneg and using NSSM directly from Adamy ) Download the latest version of Windows Service Wrapper via github or nuget . Current version as of this writing is v2.2.0 Since

How to create an installer for a .net Windows Service using Visual Studio

好久不见. 提交于 2019-11-27 16:37:37
How do I create an installer for a Windows Service that I have created using Visual Studio? In the service project do the following: In the solution explorer double click your services .cs file. It should bring up a screen that is all gray and talks about dragging stuff from the toolbox. Then right click on the gray area and select add installer. This will add an installer project file to your project. Then you will have 2 components on the design view of the ProjectInstaller.cs (serviceProcessInstaller1 and serviceInstaller1). You should then setup the properties as you need such as service