windows-services

How to install a service on windows 7 without Visual Studio?

喜你入骨 提交于 2019-12-04 10:58:39
Install a windows service: there is a util with Visual Studio: InstallUtil.exe. If I have a service MyService.exe and want to install it on a windows 7 without Visual Studio on it, how can I install it? user1899501 You can try NSSM (Non-Sucking Service Manager) for the times the "sc" doesn't work quite as expected. http://nssm.cc I had an service I built in Go not too long ago that I could not get to run under "sc", nssm worked perfectly. seva titov One way is to use sc.exe, which is part of OS. Example: sc create **ServiceName** start= auto binPath= "c:\mydir\myService.exe" where binPath is

How to launch a GUI program in a Windows service?

折月煮酒 提交于 2019-12-04 10:56:31
问题 When I run a service as LocalSystem account, I can use following codes to launch a GUI program under current login account: WTSGetActiveConsoleSessionId->WTSQueryUserToken->CreateProcessAsUser However, when I run the service as my personal account, the GUI program will NOT show up. I can see it in task manager though. What should I do to launch the GUI program when the service is running under my personal account? 回答1: John and jdigital are both right - from my understanding, services can

How to Create a C# Listener Service for MSMQ as a Windows Service

筅森魡賤 提交于 2019-12-04 10:26:10
问题 I'll start by saying I'm not a .NET developer, but have been thrown into a project where I need to use MSMQ so a classic ASP web application can send messages to a C# Windows Service that handles the processing. I have experience integrating other message queues with other languages, but like I mentioned, I don't have much experience with .NET and Windows development so some guidance would be much appreciated. Here are my questions... Could someone provide some basic C# code that listens to

How to write an URI string in App.Config

牧云@^-^@ 提交于 2019-12-04 10:11:49
问题 I am making a Windows Service . The Service has to donwload something every night, and therefor I want to place the URI in the App.Config in case I later need to change it. I want to write an URI in my App.Config. What makes it invalid and how should i approach this? <appSettings> <add key="fooUriString" value="https://foo.bar.baz/download/DownloadStream?id=5486cfb8c50c9f9a2c1bc43daf7ddeed&login=null&password=null"/> </appSettings> My errors: - Entity 'login' not defined - Expecting ';' -

What is the accepted pattern for an application that can be run as a service or as a console application

夙愿已清 提交于 2019-12-04 10:01:23
问题 I have a project that is deployed to production as a windows service. However for local development purposes it would be useful to run it as a console application. At the moment I have a class Called ReportingHost that provides my core functionality, And a class called ReportingServiceHost that inherits from ServiceBase and allows me to run the application as a service. There is also a program class with a main method that calls ServiceBase.Run on my ReportingServiceHost. I think I need to

Delphi Win32 Service “Printer Selected is not valid” error on 2008 64bit standard server

假如想象 提交于 2019-12-04 09:57:52
I have developed a simple win 32 service in delphi 7 which performs some print operations. All works fine on our XP machines, but fails on the target Windows 2008 standard server . When I put a try except block around the print statement, it results in the "Printer Selected is not valid" error. When I check the Printer object for count of printers and event write out all the printers available in the Printer object to a file, it works fine. Only when I try to perform a print (on any printer local and network), it fails. Based on lot of research using google, I found quite a few suggestions to

CreateProcessAsUser Creating Window in Active Session

妖精的绣舞 提交于 2019-12-04 09:14:11
问题 I am using CreateProcessAsUser from a windows service ( please can we stay on-topic and assume I have a very good reason for doing this ). Contrary to what everyone else is asking here I am getting a window in my active terminal session (session 1) instead of the same session as the service (session 0) - which is undesirable. I appropriated Scott Allen's code; and came up with the following. Notable changes are the "revert to self", the "CREATE_NO_WINDOW" and command-line args support. using

How to get the status of a service programmatically (Running/Stopped)

拜拜、爱过 提交于 2019-12-04 09:03:01
I need to get the status of Windows "print spooler" service in my C++ application. Use QueryServiceStatus or QueryServiceStatusEx . There are plenty of examples on the web on how these are used. The function that @shikarssj provided is working perfectly, it only requires admin rights when loading the service. Here is a version that does not ask for full permission: #include <Windows.h> int GetServiceStatus( const char* name ) { SC_HANDLE theService, scm; SERVICE_STATUS m_SERVICE_STATUS; SERVICE_STATUS_PROCESS ssStatus; DWORD dwBytesNeeded; scm = OpenSCManager( nullptr, nullptr, SC_MANAGER

Get appdata\local folder path in C# windows service

▼魔方 西西 提交于 2019-12-04 09:00:30
问题 I am try to get C:\Users\<username>\AppData\Local folder path using Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) in a C# Windows service, but it returns some other path C:\Windows\ServiceProfiles\LocalService\AppData\Local Does any have any idea how to do it correctly? 回答1: Are you running the service under a user account? If not, the service will use its own profile as you see. If this service is "logged into" by a user, then you could pass the folder to the

Install a service on Windows (Vista/XP/7) using Inno Setup

这一生的挚爱 提交于 2019-12-04 08:44:58
问题 I need to install and run a service when install an application (installer.exe is created using Inno Setup) I used codes below [Run] Filename:"{sys}\myservice.exe "; Parameters: "-install" I am not sure if this is correct (I add codes to reminder reboot but I wonder if it is possible to run the service immediately after installation without reboot pc.) [Setup] AlwaysRestart=yes Welcome any comment. 回答1: Use sc.exe, It is simple, the only drawback is you may have to intercept and parse output