windows-services

Run batch file as a Windows service

我与影子孤独终老i 提交于 2019-12-17 02:55:28
问题 In order to run one application, a batch file has to be kicked off (which does things like start Jetty, display live logs, etc). The application will work only if this batch file is running. I am hence forced to have this batch file running and not logout from the Windows server. Can this batch file be run as a service? I am experimenting with one of the suggestions from a similar question. 回答1: NSSM is totally free and hyper-easy, running command prompt / terminal as administrator: nssm

How to start a process from windows service into currently logged in user's session

柔情痞子 提交于 2019-12-17 02:26:41
问题 I need to start a program from Windows Service. That program is a user UI application. Moreover that application should be started under specific user account. The problem is that a Window Services run in session #0, but a logged in user sessions are 1,2 etc. So the question is: how to start a process from a window service in such a way that it run in currently logged in user's session? I'd emphasis on that the question is not about how to start a process under specific account (it's obvious

How can a windows service programmatically restart itself?

让人想犯罪 __ 提交于 2019-12-16 23:39:13
问题 I need to write robust code in .NET to enable a windows service (server 2003) to restart itself. What is the best way to so this? Is there some .NET API to do it? 回答1: Set the service to restart after failure (double click the service in the control panel and have a look around on those tabs - I forget the name of it). Then, anytime you want the service to restart, just call Environment.Exit(1) (or any non-zero return) and the OS will restart it for you. 回答2: Dim proc As New Process() Dim psi

Detecting USB drive insertion and removal using windows service and c#

会有一股神秘感。 提交于 2019-12-16 22:37:14
问题 Looking into possibility of making an USB distributed application that will autostart on insertion of an USB stick and shutdown when removing the stick Will use .Net and C#. Looking for suggestion how to approach this using C#? Update: Two possible solutions implementing this as a service. - override WndProc or - using WMI query with ManagementEventWatcher 回答1: You can use WMI, it is easy and it works a lot better than WndProc solution with services. Here is a simple example: using System

Detecting USB drive insertion and removal using windows service and c#

谁说胖子不能爱 提交于 2019-12-16 22:37:02
问题 Looking into possibility of making an USB distributed application that will autostart on insertion of an USB stick and shutdown when removing the stick Will use .Net and C#. Looking for suggestion how to approach this using C#? Update: Two possible solutions implementing this as a service. - override WndProc or - using WMI query with ManagementEventWatcher 回答1: You can use WMI, it is easy and it works a lot better than WndProc solution with services. Here is a simple example: using System

Windows Service Question

流过昼夜 提交于 2019-12-14 04:25:33
问题 I have 3 Windows Service Question Is WS can work in background ? Is it possible to do some job every 2 minutes ? (if yes, can I get some help ?) How can I install WS in simple way ? (not with Installutil.exe .......) How can I run .exe file from Windows service ? I've tried this way: System.Diagnostics.Process G = new Process(); G.StartInfo.FileName = @"d:\demo.exe"; G.Start(); but it didn't work. 回答1: Yes a windows service can and does work in the background. To do the same job every 2

how to use windows service in windows form application [closed]

喜你入骨 提交于 2019-12-14 04:15:20
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . how to use windows service in windows form application? I am having the database table , consists of Gold, silver,etc.. Prices. These can be displayed in Windows Form. I want to Update those things periodically

windows services

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-14 04:13:09
问题 Is it possible to create a windows service which will be unstoppable until the machine gets shutdown. Because I want to run one of my applications along with the service, is it possible to do it? Thanks, just tell me how to run my application along with the service. 回答1: You cannot create a process that is un-killable in Windows. Otherwise Windows would do this to critical processes (kill csrss.exe for a quick BSOD). With careful setting of service and process ACLs you can make it harder, but

How to increase the web service timeout in a Windows Service application?

我只是一个虾纸丫 提交于 2019-12-14 03:57:56
问题 I am working on a web application that uses an asmx web service to import data in IIS7. We have a Windows Service pick up a file to import and send it thru the web service. I am getting the following error during large imports after 1 minute: The request channel timed out while waiting for a reply after 00:00:59.9843750. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding. The time allotted to this operation may have been a portion of a

Bad timer in Windows service

做~自己de王妃 提交于 2019-12-14 03:35:08
问题 i have timer in my windows service, but the windows service does not do what it should do.. I want ask you, if i have good code with timer? Part of my code (updated): protected override void OnStart(string[] args) { timer = new System.Timers.Timer(); timer.Elapsed += new ElapsedEventHandler(getFileList); timer.Interval = 10000; timer.Enabled = true; timer.AutoReset = false; } private void getFileList(object sender, EventArgs e) { //Work with xml... DeleteOldBackupFiles(); } private void