windows-services

How can I monitor a directory for newly uploaded files?

I need to create a windows service that will monitor a directory for newly uploaded files. The files will be around 100K to 400K in size. Is there a chance that my monitoring system will notice a new file, but the file hasn't completetly finished copying over? i.e. it is still streaming in and the EOF hasn't been written yet? ...

How do I restart a service on a remote machine in Windows?

Sometimes while debugging, I need to restart a service on a remote machine. Currently, I'm doing this via Remote Desktop. How can it be done from the command line on my local machine? ...

How can I replace the current Java process, like a unix-style exec?

I have a server written in Java that runs as a Windows service (thanks to Install4J). I want this service to be able to download the latest version of the JAR file it runs from, and start running the new code. The stitch is that I don't want the Windows service to fully exit. Ideally, I would accomplish this by a unix-style exec() cal...

Getting full path for Windows Service

How can I find out the folder where the windows service .exe file is installed dynamically? Path.GetFullPath(relativePath); returns a path based on C:\WINDOWS\system32 directory. However, the XmlDocument.Load(string filename) method appears to be working against relative path inside the directory where the service .exe file is instal...

Am I Running as a Service

Hey Everyone, I am currently writing a little bootstrap code for a service that can be run in the console. It essentially boils down to calling the OnStart() method instead of using the ServiceBase to start and stop the service (because it doesn't run the application if it isn't installed as a service and makes debugging a nightmare). ...

How do you register a Windows Service during installation?

I have built a windows service application in VB.net 2008, and used the Setup Wizard to add an installation process. The installer works, in that it adds the app to add/remove programs and copies all of the files etc, but it's missing the final (required) step of actually installing the service. I have added the primary output of the P...

What services are required by SQL Express/SQL Server?

One of our partners recently reported that our software could not contact a remote instance of SQL Express until they started the RPC Locator and SQL Server Browser services. Where would I find a list of services that must be running, on both server and client, to enable remote access to SQL Express and/or SQL Server? Sadly, the SQL Exp...

How can I mount a windows drive in Java?

We are working with some legacy code that accesses a shared drive by the letter (f:\ for example). Using the UNC notation is not an option. Our Java wrapper app will run as a service, and as the first step, I would like to map the drive explicitly in the code. Has anyone done this? ...

.Net 2.0 ServiceController.GetServices()

I've got a website that has windows authentication enable on it. From a page in the website, the users have the ability to start a service that does some stuff with the database. It works fine for me to start the service because I'm a local admin on the server. But I just had a user test it and they can't get the service started. My qu...

How to change system default regional settings in windows XP?

How can I change the system-default regional settings in windows XP for use by services (run by the system user)? Regional and Language Options in the control panel modify the settings for the logged-in user. However, services don't use the user's settings - they use the system settings. I know that they can be found in the registry her...

How can a windows service programmatically restart itself?

I need to write robust code in .NET to enable a windows service (server 2003) to restart itself. What it the best way to so this? Is there some .NET API to do it? ...

Want to host WCF Webservice as Windows Service as against to Hosting in IIS

I want to expose few web services but thinking of hosting those as Windows Service as against hosting in IIS. Is it a good practice? If yes? How do I make it secured? I want to authenticate the users who are accessing it (against our custom security database and also want to make sure that the request is originating from our busines...

Timer in a win32 service

Hello all, Can someone please point me to the easiest way to have a timer in a Win32 service? I suppose I could create a dummy window for this purpose or have a second thread do tick counts, but what's best? Is there a more elegant way? Thanks in advance. ...

How to force uninstallation of windows service

I installed a windows service using installUtil.exe. After updating the code I used installUtil.exe again to install the service w/o uninstalling the original version first. When I now try to uninstall the service, installUtil.exe completes the uninstall successfully, but the service still appears. If I try to change its properties,...

Update a dll without stopping the service

I would like to update a dll for a server process without stopping the service. How do I do that? A bit like how asp.net automatically picks up new dlls placed in the bin folder. ...

Setting a thread priority in a service

Hello all, In my service I have a few threads that each call the CreateProcess() function to launch an external application. I would like to adjust thread (or process) priorities to normal or lower, depending on some other factors. The problem is that SetThreadPriority() function fails with an error 6 (invalid handle?). I'm passing in a...

Windows service and timer

Hi there! I need to create some windows service which will execute every N period of time. The question is - which timer control should I use: System.Timers.Timer or System.Threading.Timer one? Does it influence on something? I am asking because I heard many evidences to non correct work of System.Timers.Timer in windows services. Thank ...

Nice code template for windows service

Hi, Any links to a good template for a windows service? (looking for C# code) Something that has the basic funcationlity that I could extend. ...

Process for updating a windows service? Automated or is it manual?

Hi, If I have a windows service on a server, what is 'best practise' for updating the service? (say there was a bug in it, or I need to ad more features to it). Is there a way I could shutdown the service, patch it and get it up and running in a more automated way? (any links with code would be great) ...

How do I conditionally suppress application exceptions written to the event log?

I am working on a windows service that polls for a connection to a network enabled devices every 15 seconds. If the service is not able to connect to a device, it throws an exception and tries again in 15 seconds. All of this works great. But, lets say one of the devices is down for a day or more. I am filling up my exception log wit...