windows-services

Service hangs up at WaitForExit after calling batch file

我只是一个虾纸丫 提交于 2019-12-27 10:47:38
问题 I have a service that sometimes calls a batch file. The batch file takes 5-10 seconds to execute: System.Diagnostics.Process proc = new System.Diagnostics.Process(); // Declare New Process proc.StartInfo.FileName = fileName; proc.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; proc.StartInfo.CreateNoWindow = true; proc.Start(); proc.WaitForExit(); The file does exist and the code works when I run the same code in-console. However when it runs inside the service, it hangs

Socket Server in Windows Service

可紊 提交于 2019-12-25 13:16:15
问题 I have service application which deploys several windows services static void Main() { DebugManager manager = new DebugManager(); ServiceBase[] ServicesToRun; ServicesToRun = new ServiceBase[] { new Service1(), new Service2(), new Service3(), }; ServiceBase.Run(ServicesToRun); } Here is DebugManager public class DebugManager : BaseDebug { private AsyncServer s; public DebugManager() { s = new AsyncServer(10000); s.Start(); } public override void SendMessage(string message) { ts.SendMessage

Start multiple instances of the window service

百般思念 提交于 2019-12-25 09:17:00
问题 I have created a windows service that reads an IBM MQ messages and processes them. My Win Service is currently designed OnStart it triggers a timer interval which calls the function that calls the class which does all the work (See code below). What I am trying to accomplish is to scale (if that is the right word) the application, if there are a lot of messages on the queue to process we would like to run multiple instances/threads of the service. Ideal situation would be to have some type of

WTSSendmessage before stopping a service

て烟熏妆下的殇ゞ 提交于 2019-12-25 08:58:14
问题 Am trying to display a message box once the user tries to stop a service. For this I used WTSSendmessage API... And I called the function once the SERVICE_CONTROL_STOP event occurs.. Am I right in the above step?? Because am not getting a message box once the user trie to stop the service.. Please guide me... Below is my code snippet:: case SERVICE_CONTROL_STOP: WTSSendMessage = (fptr1)GetProcAddress(hinstLib, "WTSSendMessage"); BOOL ret = WTSSendMessage(WTS_CURRENT_SERVER_HANDLE, dwSession,

Memory leak in c# Windows service?

◇◆丶佛笑我妖孽 提交于 2019-12-25 08:33:14
问题 I have a Windows service that periodically check database for new records and processes each record in a new thread (it may take up to 10 minutes). When the service is idle right after it's started it takes like 4 MB of RAM. When it starts processing the first record it goes up to 70+ MB and stays there even when the thread is finished (I guess that's OK, because this memory can soon be needed again). Then on the next request it goes from 70 to about 100 MB and also stays there after the

XML file couldn't be detected after windows service setup

依然范特西╮ 提交于 2019-12-25 07:47:57
问题 I have created a windows service. I do the setup of the service using the windows installer. I have one XML file like a config file. Whenever i debug windows service with attaching the debug project it works fine. But after the installation i can see the event saying couldn't find the example.xml file in C:\Windows\system32. It's a repeating problem. Can anyone tell me whats going on with this. Or any suggestions? 回答1: This isn't an installer problem. Windows Services are always started with

HttpListener leaves connections in TIME_WAIT

ⅰ亾dé卋堺 提交于 2019-12-25 06:56:35
问题 I have a simple C# Windows Service that should respond "OK" to GET requests on port 8080. Everything works fine, with one simple itch... Every single request made to the service stays in TIME_WAIT. Am I missing something, I've looked around and most samples I've seen on HTTPListeners and Windows Services are doing it in a similar fashion?! private HttpListener _listener; protected override void OnStart(string[] args) { _listener = new HttpListener(); _listener.Prefixes.Add("http://*:8080/");

Sync MySQL and MSSQL databases through windows service

≯℡__Kan透↙ 提交于 2019-12-25 06:38:55
问题 I must sync 2 tables of two databases one of which is a MSSQL and the other one MySQL. I have to do this through a Windows Service. I currently have created a Windows Service, and what I currently have added to the service is : getting the data from the MySQL database and inserting it into a Data Adapter from which I plan to move the data to the MSSQL database using an insertion through transaction.Can you tell me what is the best approach to this problem and if what I'm doing right now is on

C# Timer elapsed one instance at a time

懵懂的女人 提交于 2019-12-25 06:33:42
问题 I am creating windows service. I want to run the service every 30 seconds. So I have used timer on windows service start using the following code. protected override void OnStart(string[] args) { timer1 = new Timer(); timer1.Interval = 30000; timer1.Elapsed += new ElapsedEventHandler(timer1_tick); timer1.Start(); } In timer1_tick function, I am performing some actions like updating user details, uploading and downloading files. But here I am not sure that the above action will finish within

tomcat6 windows service properties default memory

亡梦爱人 提交于 2019-12-25 06:15:47
问题 Hello I have tomcat6 as a windows server. I am considering increasing the mmeory but I am not sure how much memory it currently has. It is run as a service and there is a "Configure Tomcat" icon in the start menu This has a java-tab with "Initial memory pool" and "Maximum memory pool" both of which are empty. What is the default on these? There are also some Java Options: -Djava.io.tmpdir=C:\Tomcat6\temp -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging