-
Notifications
You must be signed in to change notification settings - Fork 308
host.RunAsService() not found #1338
Comments
Do you have a Net Core app or a Net4x app? RunAsService is only available for Net4x. |
It's Net Core. Do I have to go through the whole reverse proxy thing to get this to work, then? |
@johnsrude reverse proxies aren't involved here, the components needed for windows service support haven't been ported to .NET Core yet. You can use ASP.NET Core in a console application targeting .NET Framework 4.x to get windows service support. You could also try 2.1.0-preview1, .NET Core support has been added there. #1189 |
Or you can use the excellent package by @dasMulli that provides windows services in .net core ;) |
Change the target framework to You need to install the NuGet package Microsoft.AspNetCore.Hosting.WindowsServices. Add the following using statement to program.cs: After this the methode "RunAsService()" will be available: |
@johnsrude If you'd like to use this on .NET Core, you'll have to move to 2.1.0-preview2. We decided not to bring this back to 2.0.x (#1229) |
I am setting up a webserver for internal use using ASP.Net Core 2.x so I want to run it as a service.
I am following the instructions Host an ASP.NET Core app in a Windows Service:
The problem is that RunAsService is undefined. I have with the same code been able to run host.Run() though.
Here is the project file:
The text was updated successfully, but these errors were encountered: