windows-services

Add installer says Service name contains invalid characters, is empty, or is too long

时光总嘲笑我的痴心妄想 提交于 2019-12-21 07:06:24
问题 I've created a service, when I right click and press create installer, I get the above error message. The service name is not missing and is valid. The problem is probably in that I have a base class on my service, with a couple of properties and an empty constructor. Basically looks like this: EmailService : MyService MyService : ServiceBase The EmailService is a partial class, and the constructor calls InitializeComponent(); in the designer, which sets the servicename. I am guessing I've

How do I detect that my application is running as service or in an interactive session?

风流意气都作罢 提交于 2019-12-21 07:03:50
问题 I'm writing an application that is able to run as a service or standalone but I want to detect if the application was executed as a service or in a normal user session. 回答1: I think you can query the process token for membership in the Interactive group. From http://support.microsoft.com/kb/243330: SID: S-1-5-4 Name: Interactive Description: A group that includes all users that have logged on interactively. Membership is controlled by the operating system. Call GetTokenInformation with

Want to script Windows WMI (wmiprvse.exe) to release handle on file

爱⌒轻易说出口 提交于 2019-12-21 06:45:06
问题 I'm working with a VB Script file written by someone else that uses Windows Management Instrumentation (WMI) calls to check on the status of several Windows Services. This script runs every few minutes on set schedule. I need to upgrade/replace the .exe for those services. I stop the VB Script, stop the services, and uninstall the services so they no longer appear in the Services panel (services.msc). Unfortunately, WMI (wmiprvse.exe) still has a handle on the service .exe files. I can

Best use of Windows Service for repeating a program call

寵の児 提交于 2019-12-21 06:02:05
问题 Im building my first Windows Service. It's a component that connects to a mailbox and downloads all mails and store them on my local drive. My questions are these. What is the best way to repeat a program call in c# windows service. Im thinking of using a simple timer? Where do I start and stop the timer? is it in the service itself or the program my service is running? What code should be included in a Windows Service for the following function protected override void OnStart(string[] args)

Windows Service with NLog

让人想犯罪 __ 提交于 2019-12-21 05:56:05
问题 I am creating a Windows Service which I want to use NLog with. I want the logs to be written to the install location of the service say something like: PathToInstalledService\Logs\MyLog.txt This is of course going to require administrator priveledges. So my question is, when creating the install for the Service, what account should I use on the ServiceProcessInstaller. I have been currently using LocalService, but this account does not have the required elevation. Thanks. 回答1: During

Credential storage best practices

雨燕双飞 提交于 2019-12-21 05:17:10
问题 I'm writing a Windows service and need to make authenticated web requests. The service will not be running under the ownership of the credentials used to make the request; this implies that I need to store the credentials for the request in some way. What are the best practices here? The credentials will need to be stored in App.config (or an analog); I'd rather not have the password hanging out in plain text. As passwords change frequently, building or otherwise baking in the password to the

How do you run jvisualvm.exe under the local system account under Windows Server 2008?

无人久伴 提交于 2019-12-21 05:16:24
问题 I've been looking for a comparable approach as posted here for Windows Server 2003 for starting jvisualvm under system account. But I got the error: ...\jdk1.6.0_24\bin\jvisualvm.exe exited on ... with error code -1073741819. I found that jvisualvm is using a configuration file: ...\jdk1.6.0_24\lib\visualvm\etc\visualvm.conf This configuration file contains a default_userdir property that points to ${HOME}/... . The system account seems to have issues with ${HOME} . Changing this parameter

Windows service can't copy to file share

左心房为你撑大大i 提交于 2019-12-21 05:11:08
问题 I have a windows service set to copy files from a local directory to a samba share. The service connects via a UNC path to the server (i.e. \remoteserver\shareddir). I have logged in as the user under which the service is running, and was able to both copy files and create files on the samba share, using the UNC path. However, when running the service I am getting io exceptions that suggest a login error. I have run process monitor on that box, watching the service and I can see it finding

Gracefully terminate WCF Service - complete all open sessions and restrict new sessions

落爺英雄遲暮 提交于 2019-12-21 04:52:36
问题 I have a WCF Service that I have written, which is hosted within a Windows service. It is operating in PerSession mode. The service permits clients to open files, make changes to files and close files remotely through the service. So far all works very smoothly. When the Windows service is stopped, I would like to be able have the WCF Service not accept any new sessions and yet allow already connected clients to complete their current sessions and work (within a reasonable period/timeout).

How can I run a CLI Application as a Windows Service?

谁都会走 提交于 2019-12-21 04:25:42
问题 Say I have a third party Application that does background work, but prints out all errors and messages to the console. This means, that currently, we have to keep a user logged on to the server, and restart the application (double-click) every time we reboot. Not so very cool. I was kind of sure, that there was an easy way to do this - a generic service wrapper, that can be configured with a log file for stdout and stderr . I did check svchost.exe , but according to this site, its only for