3

I'm kicking the tires on the preview release of Service Fabric for Windows Servers found here: Create and manage a cluster running on Windows Server

We are trying to solve the problem of the perception of too many Windows services to manually manage, contemplating infrastructures that would make the services more automatically managed. We currently run on-premises, so we are looking at Service Fabric for Windows Servers, not Service Fabric on Azure.

I have a native Windows service (Windows NT Service) compiled in Embarcadero C++ Builder XE7 that currently /install and /uninstall's itself into the Windows Service Control Manager. The service binds to a port using a WebBroker to receive HTTP requests. Data is currently being retrieved from an Oracle database. It is small in scope, but in my opinion not advanced enough to call a microservice.

These particular services do not run with a console. They run via a WinMain() method instead of a main(). We do utilize a command-line parameter to pop up a form that runs the service process for easy debugging in development, but this does not block if run on the console.

What would be involved in getting this application up and running as a guest executable? Does the project need to be recompiled as a console application to run within service fabric? Any other gotcha's you foresee?

I understand that this is a preview release, so I commit to doing the research to get the answer updated if there are discrepancies with the info in the RTM.

Benjamin Brandt
  • 367
  • 3
  • 13

1 Answers1

5
  • Start here for Guest executables. Any executable will do, no console is needed.
  • Listening for incoming traffic requires ports to be mapped in the ServiceManifest file.
  • Running with elevated privileges is explained here.
  • Make sure your executable doesn't require user interaction at the console level.
LoekD
  • 11,402
  • 17
  • 27
  • What if the executable does not listen to incoming traffic and is just has a CLI? – Azure Terraformer Jan 23 '17 at 01:00
  • In that case, don't add any endpoints in the service manifest. – LoekD Jan 23 '17 at 07:44
  • but can the exe be invoked with different input parameters each time? – Azure Terraformer Jan 23 '17 at 14:00
  • no, that requires you to create a service and call the executable from there. – LoekD Jan 23 '17 at 14:03
  • thanks, that's what I suspected... I could probably just use a stateless actor and P-invoke from there rather than creating a new guest executable to P-invoke, sound reasonable? – Azure Terraformer Jan 23 '17 at 14:45
  • yes, sounds great. Or simply run the executable with arguments using Process.Start. – LoekD Jan 23 '17 at 15:39
  • What about Windows Services, though? In .NET a Windows Service has it's entry-point code located in an OnStart() method (and exit code OnStop()). You generally can't just execute a Windows Service exe from the console. Am I missing something? I don't feel like this answer actually answered the question... – Adam Plocher Oct 03 '19 at 16:24