windows-services

Error 1001: The Specified Service Already Exists. Cannot remove existing service

非 Y 不嫁゛ 提交于 2019-12-03 11:04:41
I have a service. I installed it a while ago. I need to do an update to the service. I went to the Add/Remove Programs and looked for my service, and it is not installed there. I looked at services.msc and it is there, stopped. I was able to start it and stop it. I ran a command prompt as administrator and ran sc delete [Service Name], and recieved "The specified service does not exist as an installed service." I did a sc query in the command prompt, and it is not returned. I right clicked on the installer, clicked on uninstall and recieved "This action is only valid for products that are

Play 2.0 - starting as Windows service after server restart

倖福魔咒の 提交于 2019-12-03 11:04:23
问题 I have the Play! application running as a windows service. It is implemented according to this guidance. The problem is that the RUNNING_PID at the root folder of the application is not removed when the server is restarted and the application cannot start again. I have to remove this file and start the service again manually. Is there any option to solve it? 回答1: YAJSW In case of YAJSW I found this answer with better understanding. It's of course pretty similar to link you gave, anyway keep

py2exe windows service problem

╄→尐↘猪︶ㄣ 提交于 2019-12-03 10:58:33
问题 I have successfully converted my python project to a service. When using the usual options of install and start/stop, everything works correctly. However, I wish to compile the project using py2exe, which seems to work correctly until you install the EXE as a service and try and run it. You get the following error message: Starting service CherryPyService Error starting service: The service did not respond to the start or control request in a timely fashion. My compile python file (which

How to update an installed Windows service?

坚强是说给别人听的谎言 提交于 2019-12-03 10:50:20
问题 I have written a Windows service in C#. I have since installed it on my machine, and it runs just fine. When you install a service, does the exe get copied somewhere? Or does it point to my bin folder? This is for me to know that when I update my code from time to time, do I have to uninstall and re-install my service to update it? 回答1: If the Windows service's location has not changed and the name of its executable has not changed, you should not have to uninstall and reinstall it. You can

Best practice for writing a self-updating windows service

感情迁移 提交于 2019-12-03 10:50:19
问题 We need to create a windows service that has the ability to self update. Three options spring to mind, a second service that manages the retrieval, uninstallation and installation of the first service. Use of some third party framework (suggestions welcome. I believe .NET supports automatic updating for windows forms apps, but not windows services) Use of a plugin model, whereby the service is merely a shell containing the updating and running logic, and the business logic of the service is

New Windows Service installed, fails to start: “System error 2 … system cannot find the file specified”

旧时模样 提交于 2019-12-03 10:29:58
问题 I have installed several other custom .Net windows services successfully. A new one I had recently written was very similar to the others and while it installed without error - on starting it with the service controller it failed to start with the error dialog: System error 2 ... system cannot find the file specified. After time and consternation, the only thing I could think of that was significantly different about this service was that the path and executable name were at least 10

Finally is not executed when in a Thread running in a Windows Service

≯℡__Kan透↙ 提交于 2019-12-03 10:23:49
Can anyone explain why this finally block is not executed? I have read posts about when to expect finally block not be executed, but this seems to be another case. This code needs TopShelf and log4net. I am running .net 4.5 I guess it must be the Windows Service engine that kicks in on unhandled exceptions, but why is it running before the finally block has finished? using log4net; using log4net.Config; using System; using System.Threading; using Topshelf; namespace ConsoleApplication1 { public class HostMain { static void Main(string[] args) { HostFactory.Run(x => { x.Service<HostMain>(s => {

Handle exception on service startup

旧街凉风 提交于 2019-12-03 10:20:34
I'm writing a series of Windows services. I want them to fail if errors are thrown during startup (in OnStart() method). I had assumed that merely throwing an error in OnStart() would do this, but I'm finding that instead it "Starts" and presents me with a message stating "The service has started, but is inactive. Is this correct?" (Paraphrase). How do I handle the error so it actually fails to start the service? if you are running .NET 2.0 or higher, you can use ServiceBase.Stop to stop the service from OnStart. Otherwise call Stop from a new thread. ref [devnewsgroups] ( http://www

How to determine the current windows user from a windows service?

大憨熊 提交于 2019-12-03 10:08:15
I'm writing a Windows Service using C# .NET 2005. How can I determine who the currently logged-on user is (if any)? Also is there a way to be notified when a user logs on? Alternatively, is there a way to know who has recently used the machine? I need to know the currently logged on user so I can cache some data for that user. Operating in a corporate environment there are thousands of potential users but it only makes sense to cache data for someone who uses that machine. UPDATE: This solution works well. Also see this pinvoke.net example which uses the extended structure to also retrieve

How to host 2 WCF services in 1 Windows Service?

社会主义新天地 提交于 2019-12-03 09:45:36
问题 I have a WCF application that has two Services that I am trying to host in a single Windows Service using net.tcp. I can run either of the services just fine, but as soon as I try to put them both in the Windows Service only the first one loads up. I have determined that the second services ctor is being called but the OnStart never fires. This tells me that WCF is finding something wrong with loading up that second service. Using net.tcp I know I need to turn on port sharing and start the