windows-services

Should I use a Windows Service or an ASP.NET Background Thread?

别等时光非礼了梦想. 提交于 2019-12-01 19:20:38
I am writing a web application in ASP.NET 3.5 that takes care of some basic data entry scenarios. There is also a component to the application that needs to continuously poll some data and perform actions based on business logic. What is the best way to implement the "polling" component? It needs to run and check the data every couple of minutes or so. I have seen a couple of different options in the past: The web application starts a background thread that will always run while the web application does. (The implementation I saw started the thread in the Application_Start event.) Create a

Use DispatcherTimer with Windows Service

∥☆過路亽.° 提交于 2019-12-01 19:12:52
问题 Why my DispatcherTimer don't work with Windows Service . The purpose behind that i want use DispatcherTimer for check a windows service License public OIMService() { InitializeComponent(); _dispatcherTimer = new DispatcherTimer(); if (!System.Diagnostics.EventLog.SourceExists("OIM_Log")) { EventLog.CreateEventSource("OIM_Log", "OIMLog"); } EventLog.Source = "OIM_Log"; EventLog.Log = "OIMLog"; _helpers = new ValidationHelpers(); StartTimer(); } protected override void OnStart(string[] args) {

Screen capture using windows service

℡╲_俬逩灬. 提交于 2019-12-01 19:12:31
Even there are lot of questions regarding this issue i couldn't find proper solution for this. I'm creating windows service to capture screen(windows 7). ( i tried this using windows application and it works properly. ) When I'm going to start the service then it says i cant start the service. When i check the windows log it mentioned following error. Service cannot be started. System.ComponentModel.Win32Exception (0x80004005): The handle is invalid at System.Drawing.Graphics.CopyFromScreen(Int32 sourceX, Int32 sourceY, Int32 destinationX, Int32 destinationY, Size blockRegionSize,

How to Run an exe from windows service and stop service when the exe process quits?

狂风中的少年 提交于 2019-12-01 17:54:02
I am a complete beginner to working with windows services. I have a basic skeleton worked out for the service and I am currently doing this: protected override void OnStart(string[] args) { base.OnStart(args); Process.Start(@"someProcess.exe"); } just to fire-off the exe at the start of the program. However, I'd like to have the service stop itself when the process started from the exe quits. I'm pretty sure I need to do some sort of threading (something I am also a beginner with), but I'm not sure of the overall outline of how this works, nor the specific way to stop a process from within

Visual Studio missing “Add Installer” link in service project

允我心安 提交于 2019-12-01 17:27:19
问题 I'm building a Windows service and following this MSDN article, but I'm stuck on step 3 under "Create an installer". I can't find the "Add Installer" link it's referring to. I've clicked everywhere, including following the instructions it gives exactly, but I can't seem to find it. A few people on Google have had the same problem, but never found a solution (other than adding the ServiceInstaller object and configuring it manually). Has anybody else had this problem and found a reason? I'm

Find which account a service is set to “Log On As”

一曲冷凌霜 提交于 2019-12-01 16:54:54
How to find out the user account ( Local System/User etc ) a service is set to run under ("Log On As")? Unlike this similar question this code can't run from within the service itself and the service may not be running. The System.ServiceProcess.ServiceController class has useful methods for getting the status but not the "Log On As" user. Stan R. This is the only way I know of, I found it looking around and tested it, it works. Make sure you use the Service Name not it's Display Name, you will also need to add a reference to System.Management string serviceName = "aspnet_state"; SelectQuery

How to make GUI wait for windows service?

送分小仙女□ 提交于 2019-12-01 16:43:01
I wrote a windows service and a gui for it. Of course gui mainly depends on the service. Is there a way for gui to wait for the service? Sometimes I need to reload service config from the gui and restart the service. I was thinking about 2 solutions: 1. using while and sleep to wait for service controller status to change (of course the simplest solution :P) 2. implementin INotifiPropertyChanged interface somewhere (this looks to complicated for this trivial problem). I was wondering is there more elegant way of doing it? Is there an event that I am missing somewhere? ServiceController has a

How to Run an exe from windows service and stop service when the exe process quits?

半腔热情 提交于 2019-12-01 16:25:20
问题 I am a complete beginner to working with windows services. I have a basic skeleton worked out for the service and I am currently doing this: protected override void OnStart(string[] args) { base.OnStart(args); Process.Start(@"someProcess.exe"); } just to fire-off the exe at the start of the program. However, I'd like to have the service stop itself when the process started from the exe quits. I'm pretty sure I need to do some sort of threading (something I am also a beginner with), but I'm

finding the actual executable and path associated to a windows service using c#

戏子无情 提交于 2019-12-01 16:01:39
I am working on an installation program for one of my company's product. The product can be installed multiple times and each installation represents a separate windows service. When users upgrade or reinstall the program, I would like to look up the services running, find the services that belong to the product, and then find the executable file and its path for that service. Then use that information to find which one of the services the user wishes to upgrade/replace/install/etc. In my code example below, I see the service name, description, etc, but don't see the actual filename or path.

How to make GUI wait for windows service?

萝らか妹 提交于 2019-12-01 15:34:45
问题 I wrote a windows service and a gui for it. Of course gui mainly depends on the service. Is there a way for gui to wait for the service? Sometimes I need to reload service config from the gui and restart the service. I was thinking about 2 solutions: 1. using while and sleep to wait for service controller status to change (of course the simplest solution :P) 2. implementin INotifiPropertyChanged interface somewhere (this looks to complicated for this trivial problem). I was wondering is there