windows-services

Warning window once the user tries to stop a service

倾然丶 夕夏残阳落幕 提交于 2019-12-08 09:58:20
问题 I'm writing a service in "C" and I'd like to display a warning window once the user tries to stop the service ( With "OK" and "Cancel" Buttons ). Is there any specific windows API available to achieve this? Any other simple ways are there to achieve?? 回答1: No, this is not possible. Windows services are unable to interact directly with the user's desktop, so they will be unable to show a user interface of any kind. This shouldn't really be a big deal, though. You have to have adequate

Service to process queued long-running processes - where to start?

ⅰ亾dé卋堺 提交于 2019-12-08 07:40:39
问题 What's the best way to build a service to handle queued long-running processes? For example, this is what we're trying to do User uploads 401k data to web Data goes into processing queue (a database table) 401k is processed (could take a couple minutes per client) User is informed via e-mail that 401k was accepted We could certainly write a service to handle this, but what if the service fails? How would someone be notified? What if there is an exception? Also, should this service handle

Running ffmpeg.exe through windows service fails to complete while dealing with large files

别等时光非礼了梦想. 提交于 2019-12-08 07:28:58
问题 I am using ffmpeg.exe to convert video files to flv format . For that purpose i use a windows service to run the conversion process in background . While trying to convert large files (i experienced it when the file size is >14MB) through windows service it gets stuck at the line which starts the process (ie, process.start(); ). But when i tried to execute ffmpeg.exe directly from command prompt it worked with out any problems. My code in windows service is as follows: private Thread

Using Singleton vs Single Call in .NET Remoting?

被刻印的时光 ゝ 提交于 2019-12-08 07:01:11
问题 Up until this point all the .NET remoting code I have written or worked with has been exposed as SingleCall. I ran across a .NET remoting component hosted in a Windows service that is exposed as a Singleton. This object has the potential to be called by more than one client at the same time, and it has no locks or other provisions to protect its internal state. If I understand Singleton correctly then this has the potential for big problems correct? 回答1: No more potential than a SingleCall

Pass an argument to a Windows Service at automatic startup

99封情书 提交于 2019-12-08 06:58:50
问题 I found some similar questions, yet the answers doesn't seem to help in my case. I wish to configure my service for automatic startup with 1 argument. My service OnStart method looks like this: /// <summary> /// Starts the service /// </summary> /// <param name="args">args must contain the listening port number of the service</param> protected override void OnStart(string[] args) { if (args != null && args.Length > 0) { int port = -1; if (int.TryParse(args[0], out port) && port >= 0 && port <

Multiple threads in windows service

大兔子大兔子 提交于 2019-12-08 06:50:47
问题 I have windows project and one form which have timer for each 5 seconds. It calls and processes methods from request named table time wise and condition wise. But I have some methods types which takes too much time to respond and want those methods in separate thread. So that I can run those both request types in separate threads and syncs. How can I do separate those both using thread -- multi async threads? 回答1: I recommend you look at the .NET 4.0 Task class. Firing full threads every time

Windows Service Variable Lifetime

流过昼夜 提交于 2019-12-08 06:38:24
I would like to understand the Variable lifetime on a Windows service. I have a SQL table where a temporary table stores both INFLOW and OUTFLOW records for my application. I declared two global variables like below and to this variable i assign the Row Id from the temporary table. int iTempKeyInflow = 0; int iTempKeyOutflow = 0; On elapsed time do i loose this values that the service was handling in the previous run. Basically if the timer expires before the completion of execution of a cycle, does the service cycle still run in background. So can i handle 100 records in a second from the

Run windows application from Windows service

南楼画角 提交于 2019-12-08 06:20:58
问题 I have created one windows application which should run every time in the desktop. For this we put the application in startup. But due to some exceptions or user closing the window application getting close. To avoid this I had written windows service, it will check every one minute whether application is running or not. If it is closed windows service will start the application. When i am debugging the windows service the application is running fine. But when i done setup of the service.

CreateProcessWithLogonW() problems - Need to launch sub-processes with the same user

心不动则不痛 提交于 2019-12-08 05:34:35
问题 I have a Windows executable that is launched from within a service by calling CreateProcessWithLogonW() with a set of specfied user details. This works fine and the process starts as expected. However, when this process tries to launch other processes itself, currently just using CreateProcess() these start then die straight away - they are executables that require desktop access. After reading up on Microsoft's article on CreateProcess() - http://msdn.microsoft.com/en-us/library/ms682425(VS

Installing a windows service as a user fails

人走茶凉 提交于 2019-12-08 05:34:15
问题 I'm developing a windows service using .Net framework version 3.5. It needs to call a web service on a remote machine and I'm running into a weird installation problem. I used to install it on my machine as User (the default), and when prompted provided my login and password and everything worked fine. Then at some point, it stopped working, and I found out about installing it as LocalSystem and that worked fine. Now I'm trying to call the remote web service and I'm getting an error from WCF: