-
Notifications
You must be signed in to change notification settings - Fork 307
Create a sample using Microsoft.AspNetCore.Hosting.WindowsServices #771
Comments
Is it crashing and auto-restarting? |
@Tratcher: My startup log message just gets printed over and over. I would expect it to print once and then wait for a web method to be called (which should then print another log line). When i run the .exe from the commandline it starts and then prints a warning (I assume from There are no errors logged to the file, just seems like it is running the startup, finishing and starting again. (When ive had crashes before the windows service would stop, but in this case it keeps running). Hope that makes sense ! |
My Startup file in case it helps ..
Results in ..
|
The time-stamp differences from the logs have an interesting pattern. Roughly: 2 secs, 4 secs, 8 secs, 16 secs, 32 secs... Curious. |
So do you think this a bug or have I mis-configured my startup ? (Just wondering if this is a dead-end for now or I just need to tweak my program!) |
@stephenpope I don't see anything in ASP.NET stack that could be doing exponential back-off. Perhaps Windows Service Host is doing it, though I'm not sure. There's nothing that does this in your code? |
@muratg : Nope .. all my (pretty vanilla) code is above |
@victorhurdugaci keep an eye out for this when you do your sign-offs. |
We'd be happy to take a PR for this one. |
Community library that works with .NET Core: https://github.com/dasMulli/dotnet-win32-service |
Following the guidance from http://dotnetthoughts.net/how-to-host-your-aspnet-core-in-a-windows-service/ I've been successful in getting a web project hosted as a service. |
@stephenpope I was able to get this working following the instructions @Kieranties linked above. It works with both 1.0 and 1.1. I don't see any restart issues with RunAsService. My guess is that you have a crash when your app can't reach a resource due to running as a service, something like UserSecrets, or that you're not getting UseContentRoot set appropriately for the service as shown in the linked instructions. |
I was also able to get this to work using @Kieranties link. The issues I encountered were that you first need to
If you don't do this but run it from your Also when the Windows service starts its current directory is set to the System32 folder and not that of the
|
I am trying to get an RC2 web sample hosted as windows service up and running using
Microsoft.AspNetCore.Hosting.WindowsServices
.... the
RunAsService
extension method says it blocks until the service is stopped but currently it seems to be running the Startup over and over again.(I have a simple log message inside the
Configure
method). Not sure if this is a bug or I am doing something wrong.If someone could create a working sample it would be really useful to check against.
The text was updated successfully, but these errors were encountered: