Can I have multiple services hosted in a single windows executable

I created a 3 service project (below) which uses a project installer for each service. I then added an installer project which installs the services into service manager. Here was my workflow: Create 3 services in a solution in Visual Studio 2008. Naming each service as Service1, Service2 and, Service3. (Being sure to change the … Read more

Message pump in .NET Windows service

Thanks all for your suggestions. Richard & overslacked, the link you provided in the comments was very helpful. Also, I did not have to allow the service to interact with the desktop in order to manually start a message pump with Application.Run. Apparently, you only need to allow the service to interact with the desktop … Read more

Need code example on how to run an Android service forever in the background even when device sleeping, like Whatsapp?

NOTE: NOW THIS ANSWER IS ONLY VALID FOR ANDROID 7 AND BELOW. SINCE ANDROID 8 GOOGLE HAS CHANGED HOW BACKGROUND TASKS ARE HANDLED Since I posted this question, I have implemented two different approaches to this solution into multiple apps. APPROACH 1 This extract is from an app where I use push notifications, which need … Read more

Starting ssh-agent on Windows 10 fails: “unable to start ssh-agent service, error :1058”

Yeah, as others have suggested, this error seems to mean that ssh-agent is installed but its service (on windows) hasn’t been started. You can check this by running in Windows PowerShell: > Get-Service ssh-agent And then check the output of status is not running. Status Name DisplayName —— —- ———– Stopped ssh-agent OpenSSH Authentication Agent … Read more

Execute task in background in JavaFX

JavaFX has Event Dispatch Thread which it uses for UI events. All work with UI should happen on this thread. And non-UI calculations shouldn’t happen there to avoid lags in UI. See next code: public class Indicators extends Application { public static void main(String[] args) { launch(args); } @Override public void start(Stage stage) { Pane … Read more

What exactly are “WPF services”?

Martin Fowler has a description of what a service is in his Dependency Injection article. Put simply, a service is an object that provides functionality to be used by other objects. You’ll find the term used heavily when discussing the patterns Inversion of Control and Service Locator. To make this concrete with the topic at … Read more

Print html document from Windows Service in C# without print dialog

Here’s the Holy Grail. Taking advantage of StaTaskScheduler (taken from Parallel Extension Extras (release on Code Gallery)). Features: waits for the printing completion, doesn’t show print settings, hopefully reliable. Limitations: requires C# 4.0, uses default printer, doesn’t allow to change print template TaskScheduler Sta = new StaTaskScheduler(1); public void PrintHtml(string htmlPath) { Task.Factory.StartNew(() => PrintOnStaThread(htmlPath), … Read more