windows-services

Running a batch file before tomcat service starts when user manually starts the service in services.msc

浪尽此生 提交于 2019-12-13 07:08:27
问题 I would like to know if there is any way of running an operation (like, calling a batch file) before a service is started using services.msc? I want my batch file to run before the service (tomcat installed as service) is actually started, when the user manually clicks 'Start' in Services. I don't know if this is possible or not. Thank you for your help in advance! 回答1: The answer to your question is NO , unless you want to modify Apache's procrun (which is written in C language). Depending

How can I work out why my .net service is chewing up memory?

隐身守侯 提交于 2019-12-13 07:01:12
问题 We have a .net c# service that when tured on is chewing up more and more memory. It has one 'Service' derived class that basically creates other objects that encapsulate individual functionality that the service is meant to support. Im thinking that maybe I am creating an object and its not getting garbage collected due to a programming error. Anyone know the best way to find out what is going on without setting break points? 回答1: You can use memory profilers like memprofiler, ants profiler,

Scheduling Jobs using Quartz - Need Opinion

我怕爱的太早我们不能终老 提交于 2019-12-13 06:04:02
问题 This is my requirement. Main Job: Job1 (Scheduled to run every 5 mins) Subsidiary Jobs: Job2, Job3, Job4, Job5, etc., (All subsidiary jobs will have same definitions but only JobData will differ) During every execution of "Job1" one subsidiary job will be scheduled to be executed only once. Example: 1st Execution of Job1: Job "Job2" will be scheduled 2 mins from DateTime.Now 2nd Execution of Job2: Job "Job3" will be scheduled 2 mins from DateTime.Now ... Now, I want the same Scheduled to be

Null Reference Exception [duplicate]

时光总嘲笑我的痴心妄想 提交于 2019-12-13 05:44:05
问题 This question already has answers here : What is a NullReferenceException, and how do I fix it? (29 answers) Closed 2 years ago . Frustrated have been looking at this all day... I am creating a windows service...this code works fine on a regular console application and does not work on the windows service. I am getting a null reference exception: Null reference in OnStart(): Object reference not set to an instance of an object. at VNurseService.Server.RequestServer..ctor(Server s) at

Preventing blocking dialogs/message boxes/hanging GUI from non-interactive processes on Windows?

妖精的绣舞 提交于 2019-12-13 05:44:05
问题 We are developing C++ apps (lots of MFC) with Visual Studio 2005 on Windows. From time to time it happens that our nightly builds and/or unit tests hang because some part of some app or helper tool opens a message box in a corner case that is hit by the build. Since the automated stuff is run (by a Windows Service) without any desktop session attached, obviously no-one can confirm - or even read - the GUI messages. Is there any way to have Windows prevent apps from opening dialogs? Or maybe a

How to implement bulk mailing using windows service on a schedule basis?

眉间皱痕 提交于 2019-12-13 05:41:50
问题 I've a requirement in which i need to send 10000+ mails on a quarterly basis . For this purpose i used a windows service that triggers every day and executes the mailing functionality only after the third month. I've to fetch last three months records from database and need to send one mail for each record. The problem i faced was the mail server i used do not allow bulk mailing. How can i do this effectively by providing a delay between each sent (20 mails per minute)? 回答1: There are many

Changing how a service is configured

霸气de小男生 提交于 2019-12-13 04:51:18
问题 When installing a service, there is a helpful .NET class called ServiceProcessInstaller . This class has a property Account , which is a ServiceAccount enumeration with possible values LocalService, LocalSystem, NetworkService and User. This is fine at install-time, but does anybody know how I can change this value for an existing service? I assuming that I need to move away from the actual install-type classes, and have been researching hooking into the advapi32 ChangeServiceConfig method,

How do I send many http requests at the same time?

馋奶兔 提交于 2019-12-13 04:49:04
问题 I have an eBay account. To make updating my products easily, I created a windows service in C#. It waits (by FileSystemWatcher ) for an xml file and once a file is appeared, a service reads it and sends requests to eBay server through their API. A file might hold about 1000-3000 rows. Previously I used to create 12 threads to make it faster. I don't know why I chose 12 threads, I thought that was enough amount: not too much and not too little. So here is a method how I looked like before (bit

Cannot retrieve hostname calling my TCPListener Service

孤者浪人 提交于 2019-12-13 03:59:07
问题 I am writing a simple FTP service using TcpListener and would like to find out what hostname (domain with multiple subdomains) the incoming call is using. Is this possible? //Barebone TCPListener example System.Net.Sockets.TcpListener listener; listener = new TcpListener(IPAddress.Any, 21) listener.Start(); TcpClient client = listener.AcceptTcpClient(); //Great, incoming... what domain are they using to call my service? //This only gives me the local and remote IP.. //IPEndPoint LocalEndPoint

Window service OnStop not getting called

北城余情 提交于 2019-12-13 03:55:11
问题 I have a C# Windows service. When I try to stop it goes in stopping state and when I placed the break point in onStop method then it is not getting hit. Not able to debug what is problem. I have added exception handling all over the service and also unhandled exception handling but I don't get any error. Every thing is fine with the servie it has canStop set to true and also uses RequestAdditionalTime(). I have also set legacyUnhandledExceptionPolicy enabled="true" in app.config. For me it