Code isn't executing in windows Service [duplicate] - c#

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to start a process from windows service into currently logged in user’s session
c# windows service
I have this code in the OnStart Method of the windows service.
System.Diagnostics.Process.Start("notepad.exe");
I am successfully able to start the windows service. However once the service has successfully started it doesn't open the notepad.
This is a strange problem and as i am new to windows services, help is required.

Windows services don't execute in the same context as the desktop.
Hence you won't see the application running in explorer like you would if you launched it normally.

Related

Is is possible to start/stop windows service via some other windows service or same windows service? [closed]

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 years ago.
Improve this question
Is is possible to start/stop windows service via some other windows service or same windows service? I have windows service running on multiple PCs, As I want to update that service whenever any version change, So I want to handle windows service via code with some other or same windows service?
Typically upgrading a service requires replacing its exe and supporting DLLs but no additional registry changes unless something about the service registration is to be altered (startup type for example).
There's no reason why your service cannot launch a small updater program that will stop, replace and restart the service but generally you won't succeed in getting any running program to replace itself because the exe tends to end up locked/in use while it is running. The updater program doesn't need to be registered as a service
Be mindful that you might have to launch the updater using credentials that have permission to stop/restart a service and alter the program files subfolders; services should generally run using the lowest (least permission) possible and running an updater app using the same credentials might not give high enough privileges to replace the exe
See How can a program delete its own executable for more ideas on self replacing programs

How to start a process in Administrator mode below Windows Vista? [duplicate]

This question already has answers here:
Correct way to deal with UAC in C#
(2 answers)
How to run another app as administrator on Windows XP
(3 answers)
How to start a Process as administrator mode in C# [duplicate]
(9 answers)
Closed 4 years ago.
Recently, I'm trying to start a process in Administrator Mode in which the Windows version is below Vista. I was just trying to care about the program's compatibility` is there any method that I can start a program in Administrator Mode in OS which is below Vista?
Because I want the user to choose whether they want to run in Administrator Mode or not, therefore, I don't want to activate the program as Administrator Mode mode all the time.
Note : Please do NOT mark me as duplication or rubbish question, I have read _that_ page already. I didn't try does that method works in versions which is below Vista because I don't have much resources to do so.

Start an exe. via Windows Service [duplicate]

This question already has answers here:
How can I run an EXE program from a Windows Service using C#?
(9 answers)
Closed 5 years ago.
I'm currently working on a project to automatize my backup to run only under certain circumstances. Therefor I'm writing a Windows Service in C# using Visual Studios 2015. I already got my requirements set and now I can't get my Service to run sdclt.exe (the Microsoft Default Backup). I already searched for a solution but i only found people saying that Windows Services can't start .exe anymore. Does anyone here have an idea how it might still work?
Thank You
you can create BatchFile that Run sdclt.exe or use System.Thredin.Process to Run that exe. use verbs if require to run with administrator rights.

standalone application for WCF [duplicate]

This question already has answers here:
Hosting WCF service on linux
(2 answers)
Closed 6 years ago.
I want to host a game's server on Linux - Debian8 (a VPS), but I'm having a problem: the game is written in C# and needs IIS to host the WCF part of it, which doesn't work on Linux.
Someone told me that it is possible to host a server on Debian but I should create a WCF stand-alone app.
How can I do that?
Here can you find server files which use WCF.
Could you help me with this? thanks!!
No you don't need IIS
Hosting Services
You can host in a Service console app

Programmatically install windows services on remote machines using C# [duplicate]

This question already has an answer here:
Programmatically Install Windows Service On Remote Machine
(1 answer)
Closed 6 years ago.
I would like to programmatically install using a give AD user / delete / check the status of a windows services using C#. I would need to constantly check the status of these dynamically created services from a remote machine.
Is there any way to achieve this ?
Thank you.
The solution provided in this threads suits my needs very well, and I have no issue in creating and managing remote services.
Programmatically Install Windows Service On Remote Machine

Categories