2

I need to write a long running service in .net 4.7.2. Actually in .net core I know about the worker services, but I am insecure if I can write those worker service in .net 4.7.2 as well.

The use case is that I have a library (.dll) from an extern manufacturer written in .net 4.7.2 to perform some actions on the delivered tablet from this manufacturer. I want my service to run on this tablet (windows 10) and poll some status information about this tablet (e.g. connection information) and send it to a blazor webassembly application using any technology like gRPC, REST etc...

So my question is how can I realize this using .net 4.7.2? I know about the worker services in .net core but it seems that Microsoft only supports those worker services for .net core

Marcel Müller
  • 368
  • 3
  • 17
  • 2
    https://learn.microsoft.com/en-us/dotnet/api/system.serviceprocess?view=netframework-4.8 – Hans Passant Feb 02 '22 at 12:51
  • I would also like to know the answer. I have existing services in Framework, and as part of out Core migration - which will take place in stages, I would like to get our existing service using Workers still in 4.8 If this can work, it makes our eventual migration easier. – Daniel Williams Jul 14 '22 at 15:28
  • @DanielWilliams Check out this playlist https://www.youtube.com/watch?v=uM9o8GsO_u4 Maybe this works for you – Marcel Müller Jul 19 '22 at 09:40
  • @MarcelMüller. The playlist of 9 year old videos? About making old style windows services which is exactly what we have in our framework code? – Daniel Williams Jul 20 '22 at 14:12
  • @DanielWilliams And what exactly do you want to know? – Marcel Müller Jul 21 '22 at 09:43
  • As I understand it if you want to run Services in.net core without the framework so that your programs can run on Linux, then you have to use workers and not Services. But I could be completely wrong this is why I’m asking – Daniel Williams Jul 22 '22 at 14:02
  • @DanielWilliams Yes exactly basically you need dotnet core to run .net-based programs in linux. Therefore .net core offers the worker templates which can be configured to run in windows, linux and mac. To run a worker in linux you can use Systemd as described here: https://swimburger.net/blog/dotnet/how-to-run-a-dotnet-core-console-app-as-a-service-using-systemd-on-linux – Marcel Müller Jul 25 '22 at 08:56

0 Answers0