Install and start a Windows Service via Code - windows-services

I want to install and start (2. Button Stop and Deinstall) a service from code in C#.Net Windows Forms.
Can someone help me?

Use the ServiceController class, documented here to stop and start it.
To install, you can use InstallUtil.exe, have a look here.

Related

How can I use Electron without having X11?

I'm trying to run an application that uses Electron on my Embedded System.
The problem is that Electron has dependecies with it but i can only use wayland or frame buffer instead of X11.
Can anyone help me?
Andrea
This doesn't really answer your question, but maybe you can use Xwayland? It will set up a X11 server that acts as a Wayland client, which your electron app can connect to.

ITRS geneos window service

Could you please let me know how can we start a window service using geneos if it is stopped or staled
Thanks in advance
BR
Manoj
It can be done with Windows Win Services Plug-in.
If you are using WIN-SERVICES plug-in to display services, it comes with start/stop functionalities. All you need to do is to do a right click on the status of the service you want to start/stop and it will give you something like this:
Use the Win-Services plugin. From the active console, right click on the particular service and select start/stop service.

restart service in case of exception

I'm developing service application that must restart itself. What are the ways of doing that? Is it possible to ask system start application again if it is stopped? I'm using Delphi 2007.
Your service can programably configure recovery options for itself by calling the Win32 API ChangeServiceConfig2() function inside of its AfterInstall event. Set the dwInfoLevel to SERVICE_CONFIG_FAILURE_ACTIONS and set the lpInfo to point at a SERVICE_FAILURE_ACTIONS record describing what you want to happen when the service fails.
If you go into services.msc you can configure this for you service. You don't have to do it in code. See the Recovery tab when you open the properties of you service.

Click-once for services?

I have an app that runs as a service, and I'd like it to be able to check a URL to see if a new version is available, and if so to download and install it. I can manually hack something together, but would be great if I could create an MSI package to update the service, and any other components that are part of my distribution. I'd also like it to be done without any UI, so the user is unaware of the update.
Are there any good solutions for this?
This could be tricky depending on what your update might want to do.
If you intend on deleting and re-installing the service, this may require a reboot, which will certainly be visible to the user.
In order to replace the components of the service, the service has to be stopped first. If your service itself is detecting the update availability, it may have to kick off another process to stop the service, run the installer/updater and then restart the service.
Try installer.codeeffects.com. It has this feature.
You could try MEF (http://www.codeplex.com/MEF) and use
[Import("http://someUrl/someComponent")]
public ISomeComponent SomeService;
Its not actually an auto update, but the service could be always up to date. I am not sure if it works.. its just an idea :-)

Silverlight 3 with Weborb for Java

For some reason, i can not invoke java method deployed under Tomcat/Weborb application. When i run weborb console and invoke the method from there, there is no problem. However when i tried to call from Silverlight 3 client, it does not response at all. There is one possibility which is incorrect service gateway. But i have checked the server path to make sure it is correct. I also tried different approaches to invoke server call such as proxy and class interface mentioned inside weborb documentation. I'm stuck with this problem for two days already and can not progress any further. Is there any common mistake when it comes to this problem? Any help would appreciate.
Cheers,
Khoa Nguyen
I found the solution. This is because the gateway mapping is incorrect. For instance, When deploy under weborb, the client use localhost:8080/weborb.wo. However when you deploy underworb, the gateway mapping is now change to something like localhost:8080/weborb/console/weborb.wo something like that. You can see how your request mapped to by run the weborb console and look at the server status as you invoke your java methods.
Hope this help.
Cheers,
Khoa Nguyen
There is a new WebORB for Java 4.1 release available that fixes this mapping issue. In addition, the new code generator creates a complete client class library with complex types, enums, bindable model and proxy class for the remote Java service. The release is available here:http://www.themidnightcoders.com/products.html

Resources