windows-services

How do I configure the name of a Windows service upon installation (or easily at compile time)?

房东的猫 提交于 2019-11-27 10:35:19
问题 I've created a Windows service in C#, installed it on a server and it is running fine. Now I want to install the same service again, but running from a different working directory, having a different config file etc. Thus, I would like to have two (or more) instances of the same service running simultaneously. Initially, this isn't possible since the installer will complain that there's already a service with the given name installed. I can overcome this by changing my code, setting the

Run Java application as a service

梦想的初衷 提交于 2019-11-27 10:34:32
问题 I would like to run a Java application as a service. Unfortunately, I am limited in that I can't use something like the Java Service Wrapper (which does appear to be an excellent tool). Is there any way of running an executable JAR, as a service, without relying on external applications? I currently have the service installed, but it fails to start. This is where I am getting stuck and I haven't been able to find anything on Google other than information about the JSW. 回答1: There's an LGPL

Installing Windows Service programmatically

痞子三分冷 提交于 2019-11-27 10:34:07
How do I install a Windows Service programmatically without using installutil.exe? You can install the service by adding this code (in the program file, Program.cs) to install itself when run from the commandline using specified parameters: /// <summary> /// The main entry point for the application. /// </summary> static void Main(string[] args) { if (System.Environment.UserInteractive) { if (args.Length > 0) { switch (args[0]) { case "-install": { ManagedInstallerClass.InstallHelper(new string[] { Assembly.GetExecutingAssembly().Location }); break; } case "-uninstall": { ManagedInstallerClass

Why can't I install my service (runtime newer than loaded runtime)?

人走茶凉 提交于 2019-11-27 10:33:18
问题 So I built a service in C# and I am trying to use the following command to install it: C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\installutil.exe MyService.exe >> installLog.txt It fails. When I look at the installLog.txt, I get this: Microsoft (R) .NET Framework Installation utility Version 2.0.50727.3053 Copyright (c) Microsoft Corporation. All rights reserved. Exception occurred while initializing the installation: System.BadImageFormatException: Could not load file or assembly 'file:

Install Windows Service created in Visual Studio

心已入冬 提交于 2019-11-27 10:24:28
When I create a new Windows Service in Visual Studio 2010, I get the message stating to use InstallUtil and net start to run the service. I have tried the following steps: Create new project File -> New -> Project -> Windows Service Project Name: TestService Build project as is (Service1 constructor, OnStart, OnStop) Open command prompt, run "C:\Windows\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe" TestService.exe Run net start TestService . Output of step 4 Running a transacted installation. Beginning the Install phase of the installation. See the contents of the log file for the C:

Windows Service that runs Periodically

…衆ロ難τιáo~ 提交于 2019-11-27 10:22:08
问题 I'm writing a windows service that once started will run every X hours. The process it completes is fairly intensive, so I want to use a background worker. I'm using a Settings file to store both the hours between runs and the last time the service ran. I'm not exactly sure the best way to do this - that is, I want the service to idle using as few resources as possible, and when it runs, it needs to run in the background worker, report what it did, and then go back into idle mode. I've

Running a Ruby Program as a Windows Service?

[亡魂溺海] 提交于 2019-11-27 10:20:12
Is it possible to run a ruby application as a Windows Service? I see that there is a related question which discusses running a Java Application as a Windows Service , how can you do this with a Ruby application? mwilliams Check out the following library: Win32Utils . You can create a simple service that you can start/stop/restart at your leisure. I'm currently using it to manage a Mongrel instance for a Windows hosted Rails app and it works flawlessly. Jonke When trying the Win32Utils one really need to studie the doc and look over the net before finding some simple working example. This

“Automatic” vs “Automatic (Delayed start)”

人盡茶涼 提交于 2019-11-27 10:03:40
When installing Windows services there are two options for automatically starting a Windows service on Windows startup. One is Automatic , and the other is Automatic (Delayed start) . What is the difference between these two in detail? For example, if you're creating the installer with wixtoolset, the ServiceConfig element has the DelayedAutoStart attribute. How will that effect what happens when services are started at boot time? WiX documentation: ServiceConfig Element Colin Pickard In short, services set to Automatic will start during the boot process, while services set to start as Delayed

show a windows form from a window service

喜欢而已 提交于 2019-11-27 09:47:45
i am creating a window service. my requirement is to display window form from window NT service on particular interval. For testing purpose , i just want to display the form on service start: protected override void OnStart(string[] args) { eventLog1.WriteEntry("In OnStart -before form show"); Messager_Form obj = new Messager_Form(); obj.Show(); // System.Diagnostics.Process.Start("calc.exe"); eventLog1.WriteEntry("In OnStart -after form show"); // timer1.Start(); } it not working. Neither form is showing nor calc process is running. i have found some links showing pop up , but most of them

Self install Windows Service in .NET

白昼怎懂夜的黑 提交于 2019-11-27 09:38:45
问题 I have read this question. I have same issue, but I don't understand the answer from lubos hasko. How exactly can I do it? Can you someone post me full walkthrough? When I run code below, something is installed, but in list of service, I could not find it. I have this, but this not work: using System; using System.Collections.Generic; using System.Configuration.Install; using System.Linq; using System.Reflection; using System.ServiceProcess; using System.Text; using System.IO; namespace