I would like to know if is there any way to set the description in a service directly in the code?
The app is a worker service console .net 6.0 and I'm using the extension for windows services and using it with: .UseWindowsService()
I checked some websites but didn't found anything, the last one I checked was: https://learn.microsoft.com/en-us/dotnet/architecture/grpc-for-wcf-developers/self-hosted
Anyone know if it is possible to set the description, display name and service name?
In the code I didn't tryed anything because I could not really find anything about it.
One thing you may have missed from the article you linked happens to be the point where you would set the Service Name, Display, and Description:
.. Then, use the sc tool to create a Windows service for the executable file.
sc create MyService binPath=C:\MyService\MyService.exe
Referring to the doco for sc create and sc description, you'll need to issue both commands:
sc create MyServiceName binPath="C:\MyService.exe" displayName="My displayname"
sc description MyServiceName "My description"
(I have no idea why they couldn't embed the description into sc create
)