windows-services

Getting full path for Windows Service

二次信任 提交于 2019-12-02 16:29:45
How can I find out the folder where the windows service .exe file is installed dynamically? Path.GetFullPath(relativePath); returns a path based on C:\WINDOWS\system32 directory. However, the XmlDocument.Load(string filename) method appears to be working against relative path inside the directory where the service .exe file is installed to. Try System.Reflection.Assembly.GetEntryAssembly().Location Curtis Yallop Try this: AppDomain.CurrentDomain.BaseDirectory (Just like here: How to find windows service exe path ) Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location)

Installed program is removed automatically everytime when server restarts from windows server 2012 R2 [closed]

六眼飞鱼酱① 提交于 2019-12-02 15:33:42
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 3 months ago . I created one service in C# and created installer for that.Installer is working fine and service is installed properly on server. But here is one problem. When server restarts the program connected to service automatically getting deleted from C:\ProgrameFiles location, but

How to uninstall a windows service and delete its files without rebooting

只愿长相守 提交于 2019-12-02 15:26:29
My current project involves deploying an upgraded .exe file that runs as a Windows Service. In order to overwrite the existing .exe with the new version, I currently need to: Stop the service Uninstall the service Reboot the system (so Windows releases it's hold on the file) Deploy the new .exe Reinstall the service Start the upgraded service. I'd like to avoid the reboot, so that this can be a fully scripted/automated upgrade. Is there any way to avoid rebooting? Maybe a command-line tool that will force Windows to give up it's death grip on the old .exe? sc delete "service name" will delete

How can I run an exe or windows service in medium trust?

寵の児 提交于 2019-12-02 14:26:13
问题 I would like to run exes and Windows Services in Medium Trust, but all the literature I can find suggests using <system.web> <trust level="Medium"/> </system.web> for ASP.NET, so I have tried that but using code from How do you check if you are running in Medium Trust environment in .NET? it still appears to have full trust. What is the correct way to do this? 回答1: The available approaches depend on the .NET version. Prior to .NET 4.0, the CLR enforced CAS policy, which made it possible to

How to get all Windows service names starting with a common word?

会有一股神秘感。 提交于 2019-12-02 14:16:40
There are some windows services hosted whose display name starts with a common name (here NATION). For example: NATION-CITY NATION-STATE NATION-Village Is there some command to get all the services like 'NATION-'. Finally I need to stop, start and restart such services using the command promt. Chandan Kumar sc queryex type= service state= all | find /i "NATION" use /i for case insensitive search the white space after type= is deliberate and required wimh Using PowerShell , you can use the following Get-Service | Where-Object {$_.displayName.StartsWith("NATION-")} | Select name This will show a

How to uninstall a Windows Service when there is no executable for it left on the system?

牧云@^-^@ 提交于 2019-12-02 13:52:01
How do I uninstall a Windows Service when there is no executable for it left on the system? I can not run installutil -u since there is not executable left on the system. I can still see an entry for the service in the Services console. The reason for this state is probably because of a problem in the msi package that does not remove the service correctly, but how do I fix it once the service is in this state? Treb You should be able to uninstall it using sc.exe (I think it is included in the Windows Resource Kit) by running the following in an "administrator" command prompt: sc.exe delete

Installed program is removed automatically everytime when server restarts from windows server 2012 R2 [closed]

老子叫甜甜 提交于 2019-12-02 13:23:13
I created one service in C# and created installer for that.Installer is working fine and service is installed properly on server. But here is one problem. When server restarts the program connected to service automatically getting deleted from C:\ProgrameFiles location, but service is still there and when restarting this service. I am getting prompt like "windows can not find specified program path". Can somebody help me what I am missing here or what is potential cause for this problem? I know the the scope of this question is too broad to answer but still I want some hints or any solution to

Windows installer: Error 1001, CustomAction _xxxxx.install returned actual error code 1603

夙愿已清 提交于 2019-12-02 12:44:06
问题 Question: I have created an installer for a windows service with Visual Studio 2012 and InstallShield. The service runs fine. The installer runs fine on my development machine (windows 8 64 bit) and my XP virtual machine (32 bit). But on Windows Server 2008 R2, the same installer gets "Error 10001". No further information whatsover. The following information was included in the eventlog: Product: DbBackupServiceSetup -- Error 1001. (NULL) (NULL) (NULL) (NULL) (NULL) the message resource is

How to start /stop a windows service through a Windows Form application

 ̄綄美尐妖づ 提交于 2019-12-02 12:27:50
I wish to start and stop another Windows Service application via my WIndows Form application. Ons tart of my application I wish to start the Windows service, and on application exit I wish to stop the service. How can this be achieved? You want to use the ServiceController class . Initialize it with your service name, and call Start() and Stop() methods. using System.ServiceProcess; ServiceController sc = new ServiceController("My service name"); if (sc.Status == ServiceControllerStatus.Stopped) { sc.Start(); } //etc.. 来源: https://stackoverflow.com/questions/5830440/how-to-start-stop-a-windows

Enabling/Disabling Aero from a Windows Service

守給你的承諾、 提交于 2019-12-02 12:21:38
问题 I have some code to enable/disable the Windows Aero service in Vista, and I would like to run it in a Windows Service. The code works in a standalone application, but when I run it from a Service, nothing happens. No errors or exceptions are thrown. I realise that running code in a service is a different scope than running code in an application, but in this case, how would I enable/disable Aero from the service? Is this even possible? Here is the code I am working with: public static