AspNetCore.Docs icon indicating copy to clipboard operation
AspNetCore.Docs copied to clipboard

How do we host WebAPI as a windows service using same mechanism?

Open undecided2013 opened this issue 7 years ago • 3 comments

My project was originally created with VS2019 WebApi Template

What I am starting to do is replace services.AddHostedService<ServiceA>(); with services.AddControllers();

and added

app.UseEndpoints(endpoints => { endpoints.MapControllers(); });

in the Configure method of Startup.

Am I in the right path?


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

undecided2013 avatar Oct 30 '19 14:10 undecided2013

Yes ... and you see that we're going to go with a Razor Pages sample. We'll likely add a non-web sample, but we probably won't have three to include an MVC version. The latest guidance for MVC is in the MVC node of the Web apps topics, and you can see the latest changes for 3.0 in the migration topic ... https://docs.microsoft.com/en-us/aspnet/core/migration/22-to-30?view=aspnetcore-3.0&tabs=visual-studio

guardrex avatar Oct 30 '19 14:10 guardrex

I'll be working on this topic today actually. I'll see about the possibility of having an MVC cross-link along with a Razor Pages cross-link where it will address web app-based services versus background apps (non-web app based services ... no UI).

Let's leave this open ... I'll mark the PR for it, and this issue will close automatically when the PR merges.

Thanks for commenting.

guardrex avatar Oct 30 '19 15:10 guardrex

Thank you, it's tricky when there are so many pieces of the framework changing. We need all of them to work in harmony to produce apps.

undecided2013 avatar Oct 30 '19 15:10 undecided2013