I've developed a Windows service. It installs, runs and serves its purpose. To view the results it produces, I'd like to add a simple web page with Select * from the database the services works with.
Would someone please elaborate on how to make Windows service serve a web page?
Ideally, I'd like to learn from the code of a similar project
ps. IIS is already installed on the host where the service runs
CodePudding user response:
Turned out easier than I thought https://www.youtube.com/watch?v=YUPg41kG_kw&ab_channel=BoostMyTool
CodePudding user response:
I've achieved something like this by making use of the Worker Services in .NET Core and configuring the service to run as a Windows Service.
And because I had a worker service in .NET Core, I could easily add HTTP workloads like MVC or Blazor.
In my example, I had a windows service running worker tasks as well as a Blazor UI to show the details of what was happening (I scaffolded the Blazor code fist and then added the worker via AddHostedService
).
The benefit of this is that the .NET Core is acting as the server do this process didn't need IIS on the platform plus both areas of the system are part of the same process.
If the above isn't suitable (or requires a huge migration to .NET Core), then I'd suggest using Named Pipes to communication from one process (your windows service) to another (your web-app).