A small example of a generic host based .NET core app which can be run as a Windows Service.
dotnet publish --configuration Release
sc create MyFileService binPath= "E:\Projects\IHostedServiceAsAService\IHostedServiceAsAService\bin\Release\netcoreapp2.1\win7-x64\publish\IHostedServiceAsAService.exe"
sc start MyService
For further details see my blog post Running a .NET Core Generic Host App as a Windows Service