-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to install an ASP Core .NET 6 as windows service? #74759
Comments
Tagging subscribers to this area: @dotnet/area-extensions-hosting Issue DetailsThis has relation with this issue: dotnet/aspnetcore#43547, but there I was thiking about gRPC and I considerate it is better don't mix the two quiestions. In this case I just created an ASP Core project. I followed this steps: 1.- Create a ASP Core with the template of VS2022.
When I debug this project, it works and open the webpage in the internet browser. Then i try to install the service, I use this cmd script:
The service is installed, then I go to services and it is not running, so I try to start the service manually, but i get the error 1053. If I go to the event viewer in windows, I find 2 events:
I have read the documentation in this link: https://docs.microsoft.com/en-us/aspnet/core/fundamentals/host/hosted-services?view=aspnetcore-6.0&tabs=visual-studio. How should I created the ASP Core to can install as windows service? Really my idea it is to host a gRPC service, but I try this example to start with the most simple example that I could try. Thanks.
|
I oculd solve it if in the first line of my pogram.cs I set the CurrentDirectory of the enviroment:
It is because the user that run the service, System, doesn't have permissions to write in c:\windows\system32, that is the default directory of the services. |
We have fixed this in I'm going to close this since the fix has been made in the latest version. You can continue to use the above workaround until you upgrade to 7.0. |
Thanks, it is good to know it will be fixed in the next version. |
This has relation with this issue: dotnet/aspnetcore#43547, but there I was thiking about gRPC and I considerate it is better don't mix the two quiestions.
In this case I just created an ASP Core project. I followed this steps:
1.- Create a ASP Core with the template of VS2022.
2.- Import the package Microsoft.Extensions.Hosting
3.- Import the package Microsoft.Extensions.Hosting.WebServices
4.- I use this code:
When I debug this project, it works and open the webpage in the internet browser.
Then i try to install the service, I use this cmd script:
The service is installed, then I go to services and it is not running, so I try to start the service manually, but i get the error 1053.
If I go to the event viewer in windows, I find 2 events:
I have read the documentation in this link: https://docs.microsoft.com/en-us/aspnet/core/fundamentals/host/hosted-services?view=aspnetcore-6.0&tabs=visual-studio.
How should I created the ASP Core to can install as windows service? Really my idea it is to host a gRPC service, but I try this example to start with the most simple example that I could try.
Thanks.
The text was updated successfully, but these errors were encountered: