windows-services

How to create Windows Service in C/C++? [closed]

ⅰ亾dé卋堺 提交于 2019-11-29 19:06:35
I want to create Windows Service (application running in background) using C/C++ language. How can I do this, can you give me a tutorial ? Another platform independent way is to use boost::application Example how to use can be found here . 来源: https://stackoverflow.com/questions/18557325/how-to-create-windows-service-in-c-c

How to force uninstallation of windows service

烈酒焚心 提交于 2019-11-29 18:55:35
I installed a windows service using installUtil.exe. After updating the code I used installUtil.exe again to install the service w/o uninstalling the original version first. When I now try to uninstall the service, installUtil.exe completes the uninstall successfully, but the service still appears. If I try to change its properties, I receive the message 'service is marked for deletion'. How can I force the deletion (preferrably w/o restarting the server)? One thing that has caught me out in the past is that if you have the services viewer running then that prevents the services from being

Possible to give “Network Service” on one computer permission to a directory on another computer?

青春壹個敷衍的年華 提交于 2019-11-29 18:38:38
问题 I have a file: \\Computer1\Share\file.pdf and I need to open in using a service running as the network service account on another computer: Computer2\NETWORK SERVICE FWIW, Both Computer1 and Computer2 are on the same domain Domain1 Is it possible to accomplish this task? 回答1: Yes. If both servers are on the same domain then you can enable access to the share for Domain1\Computer2$ (where Computer2$ represents Network Service on Computer2). 回答2: If it were me, I'd use a domain account to run

How can I delete a service in Windows?

三世轮回 提交于 2019-11-29 18:31:57
I have a couple old services that I want to completely uninstall. How can I do this? Lasse Vågsæther Karlsen Use the SC command, like this (you need to be on a command prompt to execute the commands in this post): SC STOP shortservicename SC DELETE shortservicename Note: You need to run the command prompt as an administrator, not just logged in as the administrator, but also with administrative rights. If you get errors above about not having the necessary access rights to stop and/or delete the service, run the command prompt as an administrator. You can do this by searching for the command

Can I use svchost.exe to host my own services?

天涯浪子 提交于 2019-11-29 18:25:46
问题 I can't find documentation for how to do it, which makes me think I'm not supposed to do it. 回答1: No, svchost.exe is undocumented and only supported for services that are part of Windows. Part of the reason is reliability - a crash in a 3rd party service should have no effect on a critical Windows service. Why do you want to use svchost? Do you have several services that you want to combine together? Creating your own exe to host multiple services is pretty straightforward. 回答2: Comment in

How can a WPF application be launched before I logon to Windows?

限于喜欢 提交于 2019-11-29 18:08:15
I would like to run WPF application before logging in to Windows. It shouldn't do any of existing UI just call ApplicationStartup event - it would trigger the functions I need. Currently I'm using a windows service in conjunction with app, so service runs before logging in. The downside now is that my app doesn't know what the service is doing without polling it. And this is a requirement as machines can crash and restart itself, but Windows should still be running application anyway after boot up. Is there any way? Cody Gray No, this is not possible. WPF applications are user-mode

c# windows service

半世苍凉 提交于 2019-11-29 17:55:02
I have a running windows service. I would like to monitor a c# console application from the windows service . My c# console application reads and writes in the console a sum, multiplication. I would like to open and work with my console application using my windows service . What should i write in OnStart() method in order to execute properly my c# code. I did put in windows service the exe file (Process.start()) from my console application code but i have the error: console application stopped from working . WHY? please help me:). I know windows services do not work with GUI applications .

Cannot restart a Service

余生颓废 提交于 2019-11-29 17:41:11
I have this code to restart a service, but this is not working. I can start and stop individually but not restart which involves me to first stop and start the service. try { //service.Stop(); //service.Start(); int millisec1 = Environment.TickCount; TimeSpan timeout = TimeSpan.FromMilliseconds(timeoutMilliseconds); service.Stop(); service.WaitForStatus(ServiceControllerStatus.Stopped, timeout); // count the rest of the timeout int millisec2 = Environment.TickCount; timeout = TimeSpan.FromMilliseconds(timeoutMilliseconds - (millisec2 - millisec1)); service.Start(); service.WaitForStatus

How does one find out if a Windows service is installed using (preferably) only batch?

℡╲_俬逩灬. 提交于 2019-11-29 17:09:40
问题 I need to check if a Windows service is installed from a batch file. I can dip into something other than batch if I need to, but I would prefer not to. Is there any way to do this? 回答1: Try this: @echo off SC QUERY ftpsvc > NUL IF ERRORLEVEL 1060 GOTO MISSING ECHO EXISTS GOTO END :MISSING ECHO SERVICE MISSING :END Note that the SC QUERY command queries by the short service name not the display name. You can find this name by looking at the General tab of a service's properties in Service

How to Host a WCF Service in a Managed Windows Service?

℡╲_俬逩灬. 提交于 2019-11-29 16:38:20
I have 3 project in my solution. Test Client => for add reference and access via tcp ip WcfServiceLibruary1 => for executing my methots WindowsService1 => for installing&running as windows service(Account:Network Service , StartType:Automatic) I used all same codes on msdn sample http://msdn.microsoft.com/en-us/library/ff649818.aspx I use a wcf service that has 2 methots.I want to use this wcf service in managed windows service.I added a windows service to my solution and set references stuff. I use this address referance on my wcf - app.config: net.tcp://localhost:2023/Service1 NOW PROBLEM IS