Update Host a Windows Service topic#5315
Merged
scottaddie merged 2 commits intoJan 31, 2018
Merged
Conversation
Update Updates
scottaddie
reviewed
Jan 31, 2018
| The recommended way to host an ASP.NET Core app on Windows without using IIS is to run it in a [Windows Service](/dotnet/framework/windows-services/introduction-to-windows-service-applications). When hosted as a Windows Service, the app can automatically start after reboots and crashes without requiring human intervention. | ||
|
|
||
| [View or download sample code](https://github.com/aspnet/Docs/tree/master/aspnetcore/host-and-deploy/windows-service/sample) ([how to download](xref:tutorials/index#how-to-download-a-sample)). See the [Next Steps](#next-steps) section for instructions on how to run it. | ||
| [View or download sample code](https://github.com/aspnet/Docs/tree/master/aspnetcore/host-and-deploy/windows-service/sample) ([how to download](xref:tutorials/index#how-to-download-a-sample)). For instrucitons on how to run the sample app, see the sample's *README.md* file. |
Member
There was a problem hiding this comment.
instrucitons --> instructions
Collaborator
Author
There was a problem hiding this comment.
DAH! ..... no spell check run this time obviously.
| 1. Test by creating and starting the service. | ||
|
|
||
| The `binPath` value is the path to the app's executable, including the executable filename itself. | ||
| Open an administrator command prompt window to use the [sc.exe](https://technet.microsoft.com/library/bb490995) command-line tool to create and start a service. If the service is named MyService, published to `c:\svc`, and named AspNetCoreService, the commands are: |
Member
There was a problem hiding this comment.
I suggest we use "command shell" instead of "command prompt window". How about "Open a command shell with administrative privileges..."?
| [!code-csharp[](windows-service/sample/WebHostServiceExtensions.cs?name=ExtensionsClass)] | ||
|
|
||
| ## Next steps | ||
| 1. In `Program.Main`, call the new extension method,`RunAsCustomService`, instead of `RunAsService`: |
Member
There was a problem hiding this comment.
Add a space before RunAsCustomService
|
|
||
| 1. Publish the app to the folder with `dotnet publish --configuration Release --output c:\\svc`. The command will move the app's assets to the folder, including the required `appsettings.json` file and the `wwwroot` folder with its contents. | ||
|
|
||
| 1. Open an **administrator** command prompt. |
Member
There was a problem hiding this comment.
command prompt --> command shell
Collaborator
Author
|
Thanks @scottaddie for the quick review. Changes made. 👍 |
scottaddie
approved these changes
Jan 31, 2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces #5095
Internal Review Topic
Thanks to @seprix91 for bringing this to our attention.