將 ASP.NET Core 應用程式部署至 Azure App ServiceDeploy ASP.NET Core apps to Azure App Service

Azure App ServiceMicrosoft 雲端運算平台服務,用於裝載 Web 應用程式,包括 ASP.NET Core。Azure App Service is a Microsoft cloud computing platform service for hosting web apps, including ASP.NET Core.

有用的資源Useful resources

App Service 文件是 Azure 應用程式文件、教學課程、範例、使用說明指南與其他資源的首頁。App Service Documentation is the home for Azure Apps documentation, tutorials, samples, how-to guides, and other resources. 關於裝載 ASP.NET Core 應用程式,有兩個值得參考的教學課程:Two notable tutorials that pertain to hosting ASP.NET Core apps are:

在 Azure 中建立 ASP.NET Core Web 應用程式Create an ASP.NET Core web app in Azure
在 Windows 上使用 Visual Studio 建立 ASP.NET Core Web 應用程式並將其部署到 Azure App Service。Use Visual Studio to create and deploy an ASP.NET Core web app to Azure App Service on Windows.

在 Linux 上的 App Service 中建立 ASP.NET Core 應用程式Create an ASP.NET Core app in App Service on Linux
在 Linux 上使用命令列建立 ASP.NET Core Web 應用程式並將其部署到 Azure App Service。Use the command line to create and deploy an ASP.NET Core web app to Azure App Service on Linux.

請參閱 App Service 儀表板上的 ASP.NET Core ,以取得 Azure App 服務提供的 ASP.NET Core 版本。See the ASP.NET Core on App Service Dashboard for the version of ASP.NET Core available on Azure App service.

訂閱 App Service 的 公告 儲存機制,並監視問題。Subscribe to the App Service Announcements repository and monitor the issues. App Service 團隊會定期張貼傳入 App Service 的公告和案例。The App Service team regularly posts announcements and scenarios arriving in App Service.

若要閱讀下列文章,請參閱 ASP.NET Core 文件:The following articles are available in ASP.NET Core documentation:

使用 Visual Studio 將 ASP.NET Core 應用程式發行到 Azure
了解如何使用 Visual Studio 將 ASP.NET Core 應用程式發行到 Azure App Service。Learn how to publish an ASP.NET Core app to Azure App Service using Visual Studio.

搭配 ASP.NET Core 使用 Visual Studio 與 Git 持續部署至 Azure
了解如何使用 Visual Studio 建立 ASP.NET Core Web 應用程式,並透過 Git 持續部署將它部署到 Azure App Service。Learn how to create an ASP.NET Core web app using Visual Studio and deploy it to Azure App Service using Git for continuous deployment.

建立您的第一個管線Create your first pipeline
設定 ASP.NET Core 應用程式的 CI 組建,然後建立連續部署發行至 Azure App Service。Set up a CI build for an ASP.NET Core app, then create a continuous deployment release to Azure App Service.

Azure Web 應用程式沙箱Azure Web App sandbox
探索 Azure 應用程式平台強制實施的 Azure App Service 執行階段執行限制。Discover Azure App Service runtime execution limitations enforced by the Azure Apps platform.

針對 ASP.NET Core 專案進行疑難排解和調試
了解 ASP.NET Core 專案的相關警告和錯誤,並為其進行疑難排解。Understand and troubleshoot warnings and errors with ASP.NET Core projects.

應用程式設定Application configuration

平台Platform

應用程式服務應用程式的平臺架構 (x86/x64) ,是在 Azure 入口網站中的應用程式設定中設定,適用于裝載于 A 系列計算 (基本) 或更高裝載層的應用程式。The platform architecture (x86/x64) of an App Services app is set in the app's settings in the Azure Portal for apps that are hosted on an A-series compute (Basic) or higher hosting tier. 確認應用程式的發佈設定 (例如,在 Visual Studio 發佈設定檔 (. .pubxml) ) 符合 Azure 入口網站中應用程式服務設定的設定。Confirm that the app's publish settings (for example, in the Visual Studio publish profile (.pubxml)) match the setting in the app's service configuration in the Azure Portal.

Azure App Service 具有 64 位元 (x64) 及 32 位元 (x86) 應用程式的執行階段。Runtimes for 64-bit (x64) and 32-bit (x86) apps are present on Azure App Service. App Service 提供的 .NET Core SDK 為 32 位元,但您可以使用 Kudu 主控台或 Visual Studio 中的發佈處理序,部署在本機建置的 64 位元應用程式。The .NET Core SDK available on App Service is 32-bit, but you can deploy 64-bit apps built locally using the Kudu console or the publish process in Visual Studio. 如需詳細資訊,請參閱發佈與部署應用程式一節。For more information, see the Publish and deploy the app section.

對於具有原生相依性的應用程式而言,Azure App Service 具有 32 位元 (x86) 應用程式的執行階段。For apps with native dependencies, runtimes for 32-bit (x86) apps are present on Azure App Service. App Service 可使用的 .NET Core SDK 為 32 位元。The .NET Core SDK available on App Service is 32-bit.

如需 .net Core framework 元件和散發方法(例如 .NET Core 執行時間和 .NET Core SDK 的相關資訊)的詳細資訊,請參閱 關於 .Net core:組合For more information on .NET Core framework components and distribution methods, such as information on the .NET Core runtime and the .NET Core SDK, see About .NET Core: Composition.

PackagesPackages

包含下列 NuGet 套件,為部署至 Azure App Service 的應用程式提供自動記錄功能:Include the following NuGet packages to provide automatic logging features for apps deployed to Azure App Service:

上述套件無法從 Microsoft.AspNetCore.App 中繼套件取得。The preceding packages aren't available from the Microsoft.AspNetCore.App metapackage. 以 .NET Framework 為目標或參考 Microsoft.AspNetCore.App 中繼套件的應用程式必須明確參考應用程式之專案檔中的個別套件。Apps that target .NET Framework or reference the Microsoft.AspNetCore.App metapackage must explicitly reference the individual packages in the app's project file.

使用 Azure 入口網站覆寫應用程式設定Override app configuration using the Azure Portal

Azure 入口網站中的應用程式設定允許您為應用程式設定環境變數。App settings in the Azure Portal permit you to set environment variables for the app. 環境變數可由環境變數設定提供者取用。Environment variables can be consumed by the Environment Variables Configuration Provider.

在 Azure 入口網站中建立或修改應用程式設定並選取 [儲存]**** 按鈕後,即會重新啟動 Azure 應用程式。When an app setting is created or modified in the Azure Portal and the Save button is selected, the Azure App is restarted. 當服務重新啟動之後,環境變數便可供應用程式使用。The environment variable is available to the app after the service restarts.

當應用程式使用 泛型主機時,環境變數會在 CreateDefaultBuilder 呼叫以建立主機時載入至應用程式的設定。When an app uses the Generic Host, environment variables are loaded into the app's configuration when CreateDefaultBuilder is called to build the host. 如需詳細資訊,請參閱 ASP.NET Core 中的 .NET 泛型主機環境變數設定提供者For more information, see ASP.NET Core 中的 .NET 泛型主機 and the Environment Variables Configuration Provider.

Azure 入口網站中的應用程式設定允許您為應用程式設定環境變數。App settings in the Azure Portal permit you to set environment variables for the app. 環境變數可由環境變數設定提供者取用。Environment variables can be consumed by the Environment Variables Configuration Provider.

在 Azure 入口網站中建立或修改應用程式設定並選取 [儲存]**** 按鈕後,即會重新啟動 Azure 應用程式。When an app setting is created or modified in the Azure Portal and the Save button is selected, the Azure App is restarted. 當服務重新啟動之後,環境變數便可供應用程式使用。The environment variable is available to the app after the service restarts.

當應用程式使用 Web 主機時,環境變數會在 CreateDefaultBuilder 呼叫以建立主機時載入至應用程式的設定。When an app uses the Web Host, environment variables are loaded into the app's configuration when CreateDefaultBuilder is called to build the host. 如需詳細資訊,請參閱 ASP.NET Core Web 主機環境變數設定提供者For more information, see ASP.NET Core Web 主機 and the Environment Variables Configuration Provider.

Proxy 伺服器和負載平衡器案例Proxy server and load balancer scenarios

IIS 整合中介軟體 (當裝載處理序外時會設定轉送標頭中介軟體) 與 ASP.NET Core 模組會設定為轉送配置 (HTTP/HTTPS) 與發出要求的遠端 IP 位址。The IIS Integration Middleware, which configures Forwarded Headers Middleware when hosting out-of-process, and the ASP.NET Core Module are configured to forward the scheme (HTTP/HTTPS) and the remote IP address where the request originated. 其他 Proxy 伺服器和負載平衡器後方託管的應用程式可能需要其他設定。Additional configuration might be required for apps hosted behind additional proxy servers and load balancers. 如需詳細資訊,請參閱設定 ASP.NET Core 以處理 Proxy 伺服器和負載平衡器For more information, see Configure ASP.NET Core to work with proxy servers and load balancers.

監視和記錄Monitoring and logging

部署到 App Service 的 ASP.NET Core 應用程式會自動接收 App Service 延伸模組:ASP.NET Core 記錄整合ASP.NET Core apps deployed to App Service automatically receive an App Service extension, ASP.NET Core Logging Integration. 延伸模組讓 Azure App Service 上的 ASP.NET Core 應用程式得以進行記錄整合。The extension enables logging integration for ASP.NET Core apps on Azure App Service.

部署到 App Service 的 ASP.NET Core 應用程式會自動接收 App Service 延伸模組 ASP.NET Core 記錄延伸模組ASP.NET Core apps deployed to App Service automatically receive an App Service extension, ASP.NET Core Logging Extensions. 延伸模組讓 Azure App Service 上的 ASP.NET Core 應用程式得以進行記錄整合。The extension enables logging integration for ASP.NET Core apps on Azure App Service.

如需監視、記錄及疑難排解的資訊,請參閱下列文章:For monitoring, logging, and troubleshooting information, see the following articles:

監視 Azure App Service 中的應用程式Monitor apps in Azure App Service
了解如何檢閱應用程式和 App Service 方案的配額和計量。Learn how to review quotas and metrics for apps and App Service plans.

在 Azure App Service 中針對應用程式啟用診斷記錄Enable diagnostics logging for apps in Azure App Service
探索如何啟用及存取 HTTP 狀態碼、失敗要求和網頁伺服器活動的診斷記錄。Discover how to enable and access diagnostic logging for HTTP status codes, failed requests, and web server activity.

處理 ASP.NET Core 中的錯誤
了解處理 ASP.NET Core 應用程式錯誤的常見方法。Understand common approaches to handling errors in ASP.NET Core apps.

針對 Azure App Service 和 IIS 上的 ASP.NET Core 進行疑難排解
了解如何診斷使用 ASP.NET Core 應用程式部署 Azure App Service 的問題。Learn how to diagnose issues with Azure App Service deployments with ASP.NET Core apps.

Azure App Service 與 IIS 搭配 ASP.NET Core 時的常見錯誤參考
了解託管於 Azure App Service/IIS 之應用程式的常見部署組態錯誤,及疑難排解建議。See the common deployment configuration errors for apps hosted by Azure App Service/IIS with troubleshooting advice.

資料保護金鑰環及部署位置Data Protection key ring and deployment slots

資料保護金鑰保存至 %HOME%\ASP.NET\DataProtection-Keys 資料夾。Data Protection keys are persisted to the %HOME%\ASP.NET\DataProtection-Keys folder. 此資料夾使用網路儲存體進行保存,並會在裝載應用程式的所有電腦上同步。This folder is backed by network storage and is synchronized across all machines hosting the app. 金鑰待用時不受保護。Keys aren't protected at rest. 此資料夾對單一部署位置中應用程式的所有執行個體皆提供金鑰環。This folder supplies the key ring to all instances of an app in a single deployment slot. 各部署位置,例如預備和生產位置,不會共用金鑰環。Separate deployment slots, such as Staging and Production, don't share a key ring.

當在部署位置間交換時,使用資料保護的任何系統都將無法使用前一位置內的金鑰環,來解密儲存的資料。When swapping between deployment slots, any system using data protection won't be able to decrypt stored data using the key ring inside the previous slot. ASP.NET Cookie 中介軟體會使用資料保護來保護它的 cookie 。ASP.NET Cookie Middleware uses data protection to protect its cookies. 這會導致使用者登出使用標準 ASP.NET 中介軟體的應用程式 Cookie 。This leads to users being signed out of an app that uses the standard ASP.NET Cookie Middleware. 至於非相依於位置的金鑰環解決方案,請使用外部金鑰環提供者,例如:For a slot-independent key ring solution, use an external key ring provider, such as:

  • Azure Blob 儲存體Azure Blob Storage
  • Azure 金鑰保存庫Azure Key Vault
  • SQL 存放區SQL store
  • Redis 快取Redis cache

如需詳細資訊,請參閱ASP.NET Core 中的金鑰儲存提供者For more information, see ASP.NET Core 中的金鑰儲存提供者.

部署使用 .NET Core preview 的 ASP.NET Core 應用程式Deploy an ASP.NET Core app that uses a .NET Core preview

若要部署使用 .NET Core 預覽版本的應用程式,請參閱下列資源。To deploy an app that uses a preview release of .NET Core, see the following resources. 當執行時間可用但 SDK 尚未安裝在 Azure App Service 上時,也會使用這些方法。These approaches are also used when the runtime is available but the SDK hasn't been installed on Azure App Service.

請參閱 App Service 儀表板上的 ASP.NET Core ,以取得 Azure App 服務提供的 ASP.NET Core 版本。See the ASP.NET Core on App Service Dashboard for the version of ASP.NET Core available on Azure App service.

使用 Azure Pipelines 指定 .NET Core SDK 版本Specify the .NET Core SDK Version using Azure Pipelines

使用 AZURE APP SERVICE CI/CD 案例 ,以 Azure DevOps 設定持續整合組建。Use Azure App Service CI/CD scenarios to set up a continuous integration build with Azure DevOps. 建立 Azure DevOps 組建之後,選擇性地將組建設定為使用特定的 SDK 版本。After the Azure DevOps build is created, optionally configure the build to use a specific SDK version.

指定 .NET Core SDK 版本Specify the .NET Core SDK version

使用 App Service deployment center 建立 Azure DevOps 組建時,預設組建管線會包含、、和的步驟 Restore Build Test PublishWhen using the App Service deployment center to create an Azure DevOps build, the default build pipeline includes steps for Restore, Build, Test, and Publish. 若要指定 SDK 版本,請選取 [代理程式作業] 清單中的 [ **新增 (+) ** ] 按鈕,以新增步驟。To specify the SDK version, select the Add (+) button in the Agent job list to add a new step. 在搜尋列中搜尋 .NET Core SDKSearch for .NET Core SDK in the search bar.

新增 .NET Core SDK 步驟

將步驟移至組建中的第一個位置,使其後面的步驟使用指定版本的 .NET Core SDK。Move the step into the first position in the build so that the steps following it use the specified version of the .NET Core SDK. 指定 .NET Core SDK 的版本。Specify the version of the .NET Core SDK. 在此範例中,SDK 設定為 3.0.100In this example, the SDK is set to 3.0.100.

完成的 SDK 步驟

若要發佈 獨立部署 (SCD) ,請在步驟中設定 SCD, Publish (RID) 提供執行時間識別碼 To publish a self-contained deployment (SCD), configure SCD in the Publish step and provide the Runtime Identifier (RID).

獨立發行

部署獨立式預覽應用程式Deploy a self-contained preview app

以預覽執行階段為目標的獨立式部署 (SCD) 會在部署中包含預覽執行階段。A self-contained deployment (SCD) that targets a preview runtime carries the preview runtime in the deployment.

部署獨立式應用程式時:When deploying a self-contained app:

請遵循部署獨立式應用程式一節。Follow the guidance in the Deploy the app self-contained section.

將包含 Web 應用程式的 Docker 用於容器Use Docker with Web Apps for containers

Docker Hub 包含最新的預覽 Docker 映像。The Docker Hub contains the latest preview Docker images. 這些映像可用作為基底映像。The images can be used as a base image. 請使用映像,並以一般的方式將其部署至容器的 Web 應用程式。Use the image and deploy to Web Apps for Containers normally.

安裝預覽網站延伸模組Install the preview site extension

如果使用預覽網站延伸模組時發生問題,請開啟 dotnet/AspNetCore 問題If a problem occurs using the preview site extension, open an dotnet/AspNetCore issue.

  1. 從 Azure 入口網站瀏覽至 App Service。From the Azure Portal, navigate to the App Service.
  2. 選取 Web 應用程式。Select the web app.
  3. 在搜尋方塊中鍵入 "ex" 來篩選 "Extensions",也可往下捲動管理工具的清單。Type "ex" in the search box to filter for "Extensions" or scroll down the list of management tools.
  4. 選取 [擴充功能]。Select Extensions.
  5. 選取 [新增]。Select Add.
  6. 從清單選取 [ASP.NET Core {X.Y} ({x64|x86}) 執行階段]**** 延伸模組,其中 {X.Y} 是 ASP.NET Core 預覽版本,而 {x64|x86} 則指定平台。Select the ASP.NET Core {X.Y} ({x64|x86}) Runtime extension from the list, where {X.Y} is the ASP.NET Core preview version and {x64|x86} specifies the platform.
  7. 選取 [確定]**** 以接受法律條款。Select OK to accept the legal terms.
  8. 選取 [確定]**** 安裝延伸模組。Select OK to install the extension.

當作業完成後,會安裝最新的 .NET Core 預覽。When the operation completes, the latest .NET Core preview is installed. 確認安裝:Verify the installation:

  1. 選取 [進階工具]****。Select Advanced Tools.

  2. 在 [進階工具]**** 中選取 [移至]****。Select Go in Advanced Tools.

  3. 選取 [ Debug console > PowerShell ] 功能表項目。Select the Debug console > PowerShell menu item.

  4. 在 PowerShell 提示執行下列命令。At the PowerShell prompt, execute the following command. 在命令中使用 ASP.NET Core 執行階段版本取代 {X.Y},並以平台取代 {PLATFORM}Substitute the ASP.NET Core runtime version for {X.Y} and the platform for {PLATFORM} in the command:

    Test-Path D:\home\SiteExtensions\AspNetCoreRuntime.{X.Y}.{PLATFORM}\
    

    當已安裝 x64 預覽執行階段時,此命令會傳回 TrueThe command returns True when the x64 preview runtime is installed.

注意

應用程式服務應用程式的平臺架構 (x86/x64) ,是在 Azure 入口網站中的應用程式設定中設定,適用于裝載于 A 系列計算 (基本) 或更高裝載層的應用程式。The platform architecture (x86/x64) of an App Services app is set in the app's settings in the Azure Portal for apps that are hosted on an A-series compute (Basic) or higher hosting tier. 確認應用程式的發佈設定 (例如,在 Visual Studio 發佈設定檔 (. .pubxml) ) 符合 Azure 入口網站中應用程式服務設定的設定。Confirm that the app's publish settings (for example, in the Visual Studio publish profile (.pubxml)) match the setting in the app's service configuration in the Azure portal.

如果在同處理序模式中執行應用程式,且平台架構設定為適用於 64 位元 (x64),ASP.NET Core 模組會使用 64 位元預覽執行階段 (如果有)。If the app is run in in-process mode and the platform architecture is configured for 64-bit (x64), the ASP.NET Core Module uses the 64-bit preview runtime, if present. 使用 Azure 入口網站安裝 ASP.NET Core {X. Y} (x64) 運行 時間擴充功能。Install the ASP.NET Core {X.Y} (x64) Runtime extension using the Azure Portal.

安裝 x64 preview 執行時間之後,請在 Azure Kudu PowerShell 命令視窗中執行下列命令,以確認安裝。After installing the x64 preview runtime, run the following command in the Azure Kudu PowerShell command window to verify the installation. 在下列命令中,以的 ASP.NET Core 執行階段版本取代 {X.Y}Substitute the ASP.NET Core runtime version for {X.Y} in the following command:

Test-Path D:\home\SiteExtensions\AspNetCoreRuntime.{X.Y}.x64\

當已安裝 x64 預覽執行階段時,此命令會傳回 TrueThe command returns True when the x64 preview runtime is installed.

注意

ASP.NET Core 延伸模組可在 Azure 應用程式服務上提供適用於 ASP.NET Core 的其他功能,例如:提供 Azure 記錄。ASP.NET Core Extensions enables additional functionality for ASP.NET Core on Azure App Services, such as enabling Azure logging. 若從 Visual Studio 部署,會自動安裝延伸模組。The extension is installed automatically when deploying from Visual Studio. 若未安裝延伸模組,請為應用程式安裝。If the extension isn't installed, install it for the app.

搭配 ARM 範本使用預覽網站延伸模組Use the preview site extension with an ARM template

如果您使用 ARM 範本來建立及部署應用程式,可以使用 siteextensions 資源類型將網站延伸模組新增至 Web 應用程式。If an ARM template is used to create and deploy apps, the siteextensions resource type can be used to add the site extension to a web app. 例如:For example:

{
    ...
    "parameters": {
        "site_name": {
            "defaultValue": "{SITE NAME}",
            "type": "String"
        },
        ...
    },       
    ...
    "resources": [
        ...
        {
            "type": "Microsoft.Web/sites/siteextensions",
            "apiVersion": "2018-11-01",
            "name": "[concat(parameters('site_name'), '/AspNetCoreRuntime.5.0.x64')]",
            "location": "[resourceGroup().location]",
            "dependsOn": [
                "[resourceId('Microsoft.Web/sites', parameters('site_name'))]"
            ]
        }
    ]
}
    

發佈及部署應用程式Publish and deploy the app

若為64位部署:For a 64-bit deployment:

  • 請使用 64 位元 .NET Core SDK 來建置 64 位元應用程式。Use a 64-bit .NET Core SDK to build a 64-bit app.
  • 在 App Service 的 [組態]**** > [一般設定]**** 中,將 [平台]**** 設為 [64 位元]****。Set the Platform to 64 Bit in the App Service's Configuration > General settings. 應用程式必須使用基本或更高的服務方案,才能選擇平台位元。The app must use a Basic or higher service plan to enable the choice of platform bitness.

部署依架構不同的應用程式Deploy the app framework-dependent

  1. Build > 從 Visual Studio 的工具列中選取 [組建發佈 {應用程式名稱} ],或以滑鼠右鍵按一下方案總管中的專案,然後選取 [發行]。Select Build > Publish {Application Name} from the Visual Studio toolbar or right-click the project in Solution Explorer and select Publish.
  2. 在 [挑選發佈目標]**** 對話方塊中,確認已選取 [App Service]****。In the Pick a publish target dialog, confirm that App Service is selected.
  3. 選取 [進階] 。Select Advanced. [發佈]**** 對話方塊隨即開啟。The Publish dialog opens.
  4. 在 [發行]**** 對話方塊中:In the Publish dialog:
    • 確認已選取 [發行]**** 設定。Confirm that the Release configuration is selected.
    • 開啟 [部署模式]**** 下拉式清單,然後選取 [依架構不同]****。Open the Deployment Mode drop-down list and select Framework-Dependent.
    • 將 [目標執行階段]**** 選取為 [可攜式]****。Select Portable as the Target Runtime.
    • 如果您需要在部署時移除其他檔案,請開啟 [檔案發佈選項]**** 並選取核取方塊,以移除目的地的其他檔案。If you need to remove additional files upon deployment, open File Publish Options and select the check box to remove additional files at the destination.
    • 選取 [儲存]。Select Save.
  5. 遵循 [發佈精靈] 的其餘提示來建立新網站,或更新現有網站。Create a new site or update an existing site by following the remaining prompts of the publish wizard.

部署獨立式應用程式Deploy the app self-contained

使用 Visual Studio 或 .NET Core CLI 適用于 獨立部署 (SCD) Use Visual Studio or the .NET Core CLI for a self-contained deployment (SCD).

  1. Build > 從 Visual Studio 的工具列中選取 [組建發佈 {應用程式名稱} ],或以滑鼠右鍵按一下方案總管中的專案,然後選取 [發行]。Select Build > Publish {Application Name} from the Visual Studio toolbar or right-click the project in Solution Explorer and select Publish.
  2. 在 [挑選發佈目標]**** 對話方塊中,確認已選取 [App Service]****。In the Pick a publish target dialog, confirm that App Service is selected.
  3. 選取 [進階] 。Select Advanced. [發佈]**** 對話方塊隨即開啟。The Publish dialog opens.
  4. 在 [發行]**** 對話方塊中:In the Publish dialog:
    • 確認已選取 [發行]**** 設定。Confirm that the Release configuration is selected.
    • 開啟 [部署模式]**** 下拉式清單,然後選取 [獨立式]****。Open the Deployment Mode drop-down list and select Self-Contained.
    • 從 [目標執行階段]**** 下拉式清單中選取目標執行階段。Select the target runtime from the Target Runtime drop-down list. 預設值為 win-x86The default is win-x86.
    • 如果您需要在部署時移除其他檔案,請開啟 [檔案發佈選項]**** 並選取核取方塊,以移除目的地的其他檔案。If you need to remove additional files upon deployment, open File Publish Options and select the check box to remove additional files at the destination.
    • 選取 [儲存]。Select Save.
  5. 遵循 [發佈精靈] 的其餘提示來建立新網站,或更新現有網站。Create a new site or update an existing site by following the remaining prompts of the publish wizard.

通訊協定設定 (HTTPS)Protocol settings (HTTPS)

安全通訊協定繫結可讓您指定透過 HTTPS 回應要求時要使用的憑證。Secure protocol bindings allow you specify a certificate to use when responding to requests over HTTPS. 繫結需要針對特定主機名稱簽發的有效私密憑證 (.pfx)。Binding requires a valid private certificate (.pfx) issued for the specific hostname. 如需詳細資訊,請參閱 教學課程:將現有的自訂 SSL 憑證系結至 Azure App ServiceFor more information, see Tutorial: Bind an existing custom SSL certificate to Azure App Service.

轉換 web.configTransform web.config

如需在發佈時轉換 web.config (例如依據設定、設定檔或環境設定環境變數),請參閱轉換 web.configIf you need to transform web.config on publish (for example, set environment variables based on the configuration, profile, or environment), see 轉換 web.config.

其他資源Additional resources

Windows Server 上的 Azure App Service 使用 Internet Information Services (IIS)Azure App Service on Windows Server uses Internet Information Services (IIS). 有關基礎 IIS 技術的主題如下:The following topics pertain to the underlying IIS technology: