windows-services

How do you debug a Windows Service?

▼魔方 西西 提交于 2019-11-28 16:30:26
I read the MSDN article on the topic. To quote: Because a service must be run from within the context of the Services Control Manager rather than from within Visual Studio, debugging a service is not as straightforward as debugging other Visual Studio application types. To debug a service, you must start the service and then attach a debugger to the process in which it is running. You can then debug your application using all of the standard debugging functionality of Visual Studio. Now my problem is that my service fails to start in the first place. First it crashes, and says: An unhandled

Self install Windows Service in .NET

孤人 提交于 2019-11-28 16:12:25
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 ConsoleApplication1 { public class Service1 : ServiceBase { public Service1() { File.AppendAllText("sss.txt

How to install and start a Windows Service using WiX

瘦欲@ 提交于 2019-11-28 16:10:48
I tried to use the codes below in Wix. But when installing, the installer was freezing for like 3 minutes on status: Starting services, then I got this message "Service Jobservice failed to start. Verify that you have sufficient privileges to start system services". Is there any wrong in my codes? And can I ask the user to input the windows system user name and password during the installation to get the "privileges"? Thanks a lot! <File Id='JobServiceEXE' Name='JobService.exe' DiskId='1' Source='JobService.exe' Vital='yes' KeyPath='yes'/> <ServiceInstall Id="ServiceInstaller" Type="ownProcess

Installing a windows service from a Visual Studio Installer project

依然范特西╮ 提交于 2019-11-28 15:46:51
问题 A colleague has written a Windows Application and left me to do the installers. I have created the installer project through Visual Studio and added the primary output of the service project to the new project. When I run the installer it creates the correct folders and copies the dlls, exe and config file in, but it doesn't do the actual install of the service. The service isn't listed in the Services window, and if I double click on the exe I'm told I need to run installutil to install the

Windows service start failure: Cannot start service from the command line or debugger [duplicate]

馋奶兔 提交于 2019-11-28 15:37:15
问题 This question already has answers here : Run a Windows Service as a console app (6 answers) Closed 4 years ago . hi i'm getting this error Cannot start service from the command line or debugger. A winwows Service must first be installed(using installutil.exe) and then started with the ServerExplorer, Windows Services Afministrative tool or the NET START command. and i dont understand why im geting this error. And here is my code: { string Hash = ""; string connectionstring =

Check if a Windows service exists and delete in PowerShell

孤者浪人 提交于 2019-11-28 15:36:34
I am currently writing a deployment script that installs a number of Windows services. The services names are versioned, so I want to delete the prior Windows service version as part of the installs of the new service. How can I best do this in PowerShell? ravikanth You can use WMI or other tools for this since there is no Remove-Service cmdlet until Powershell 6.0 ( See Remove-Service doc) For example: $service = Get-WmiObject -Class Win32_Service -Filter "Name='servicename'" $service.delete() Or with the sc.exe tool: sc.exe delete ServiceName Finally, if you do have access to PowerShell 6.0:

A standalone Delphi application that can also be installed as windows service

拜拜、爱过 提交于 2019-11-28 15:21:59
问题 In Delphi you can create a standalone Windows VCL Forms application. You can also create a Windows service application. Is it possible to combine the two in a single application that can run as a standalone application and can also be installed as a Windows service? 回答1: Totally possible. The trick is to edit the .dpr to create main form when you want to run as an application and the service form when you want to run as a service. Like this: if SvComFindCommand('config') then begin //When run

Installing multiple instances of the same windows service on a server

别来无恙 提交于 2019-11-28 15:14:25
So we've produced a windows service to feed data to our client application and everything is going great. The client has come up with a fun configuration request that requires two instances of this service running on the same server and configured to point at separate databases. So far I haven't been able to get this to happen and was hoping my fellow stackoverflow members might be able to give some hints as to why. Current setup: I've set up the project that contains the windows service, we'll call it AppService from now on, and the ProjectInstaller.cs file that handles custom installation

How to solve “The specified service has been marked for deletion” error

坚强是说给别人听的谎言 提交于 2019-11-28 14:55:31
I try to remove a Windows Service with sc delete <service name> , and encounter the following error: [SC] DeleteService FAILED 1072: The specified service has been marked for deletion. What I've already done: Stopped the service, obviously. The sc queryex "<service name>" gives the following result: SERVICE_NAME: Stub service TYPE : 10 WIN32_OWN_PROCESS STATE : 1 STOPPED WIN32_EXIT_CODE : 1067 (0x42b) SERVICE_EXIT_CODE : 0 (0x0) CHECKPOINT : 0x0 WAIT_HINT : 0x0 PID : 0 FLAGS : Ensured that Microsoft Management Console is closed ( taskkill /F /IM mmc.exe ), Ensured that Event Viewer is closed ,

How do I uninstall a Windows service if the files do not exist anymore?

偶尔善良 提交于 2019-11-28 14:54:09
How do I uninstall a .NET Windows Service, if the service files does not exists anymore? I installed a .NET Windows Service using InstallUtil. I have since deleted the files but forgot to run InstallUtil /u first. So the service is still listed in the Services MMC. Do I have to go into the registry? Or is there a better way? Jorge Ferreira You have at least three options. I have presented them in order of usage preference. Method 1 - You can use the SC tool (Sc.exe) included in the Resource Kit. (included with Windows 7/8) Open a Command Prompt and enter sc delete <service-name> Tool help