在Windows 服務上裝載ASP.NET Core | net core server hosting
本文內容 ASP.NETCore應用程式可以裝載在Windows上作為Windows服務[1],不需要使用IIS。AnASP.NETCoreappcanbehostedonWindowsasaWindowsService[2]withoutusingIIS.當裝載為Windows服務時,應用程式將會在伺服器重新開機後自動啟動。WhenhostedasaWindowsService,theappautomaticallystartsafterserverreboots.查看或下載範例程式碼[3](如何下載[4])Viewordownloadsamplecode[5](howtodownload[6])必要條件Prerequisites背景工作服務範本WorkerServicetemplateASP.NETCore背景工作服務範本提供撰寫長期執行服務應用...
本文內容ASP.NET Core 應用程式可以裝載在 Windows 上作為 Windows 服務[1],不需要使用 IIS。An ASP.NET Core app can be hosted on Windows as a Windows Service[2] without using IIS. 當裝載為 Windows 服務時,應用程式將會在伺服器重新開機後自動啟動。When hosted as a Windows Service, the app automatically starts after server reboots.
查看或下載範例程式碼[3](如何下載[4])View or download sample code[5] (how to download[6])
必要條件Prerequisites 背景工作服務範本Worker Service templateASP.NET Core 背景工作服務範本提供撰寫長期執行服務應用程式的起點。The ASP.NET Core Worker Service template provides a starting point for writing long running service apps. 使用範本作為 Windows 服務應用程式的基礎:To use the template as a basis for a Windows Service app:
從 .NET Core 範本建立背景工作服務應用程式。Create a Worker Service app from the .NET Core template. 請遵循應用程式組態[7]一節中的指導方針,更新背景工作服務應用程式,以便其執行為 Windows 服務。Follow the guidance in the App configuration[8] section to update the Worker Service app so that it can run as a Windows Service. 建立新專案。Create a new project. 選取 [背景工作服務]。Select Worker S...