Azure App Service 診斷概觀

當您執行 Web 應用程式時,必須為使用者因 500 錯誤向您反映網站已關閉的所有可能問題作好準備。 App Service 診斷是一種智慧型和互動式的體驗,可協助您對應用程式進行疑難排解,而且不需設定。 如果您的應用程式發生問題,App Service 診斷將點出問題,並以正確資訊引導您更輕鬆且快速地對問題進行疑難排解並解決。

雖然此體驗對於您過去 24 小時內遇到的應用程式問題非常實用,但您可隨時使用所有診斷圖表進行分析。

App Service 診斷不僅適用於 Windows 上您的應用程式,也適用於 Linux/容器App Service EnvironmentAzure Functions 上的應用程式。

開啟 App Service 診斷

若要存取 App Service 診斷,請在 Azure 入口網站中瀏覽至您的 App Service Web 應用程式或 App Service 環境。 在左方導覽列中,按一下 [診斷並解決問題]

在 Azure Functions 中,瀏覽至您的函式應用程式,然後在頂端導覽列中按一下 [平台功能] 並從 [資源管理] 區段中選取 [診斷並解決問題]

在 App Service 診斷首頁中,您可以搜尋應用程式的徵兆,或選擇最能描述應用程式問題的診斷類別。 接下來,有一項名為「風險警示」的新功能,可提供可操作的報告來改善您的應用程式。 最後,此頁面也是您可以找到診斷工具的位置。 請參閱診斷工具

App Service Diagnose and solve problems homepage with diagnostic search box, Risk Alerts assessments, and Troubleshooting categories for discovering diagnostics for the selected Azure Resource.

注意

如果您的應用程式已關閉或執行緩慢,您可以收集分析追蹤來識別問題的根本原因。 分析是輕量型的,專為生產案例所設計。

診斷介面

App Service 診斷的首頁使用四個區段提供精簡的診斷存取:

  • 詢問 Genie 搜尋方塊
  • 風險警示
  • 疑難排解類別
  • 常用疑難排解工具

Genie 搜尋方塊是尋找診斷的捷徑。 您可以透過疑難排解類別找到相同的診斷。

App Service Diagnose and solve problems Genie search box with a search for availability app issues and a dropdown of diagnostics that match the availability search term, such as Best Practices for Availability and Performance, Web App Down, Web App Slow, High CPU Analysis, Web App Restarted.

風險警示

App Service 診斷首頁會執行一系列的設定檢查,並根據您獨特的應用程式設定提供建議。

App Service Diagnose and solve problems Risk Alerts displays proactive App checks in a tile with a count of problems found and a link to view more details.

按一下 [檢視更多詳細資料] 連結,即可檢閱執行的建議和檢查。

App Service Diagnose and solve problems Risk Alerts right hand panel, with actionable insights tailored for the current Azure Resource App, after clicking View more details hyperlink on the homepage.

疑難排解類別

對類別群組診斷進行疑難排解,以方便探索。 下列項目可供使用:

  • 可用性和效能
  • 設定和管理
  • SSL 和網域
  • 風險評估
  • 導覽器 (預覽)
  • 診斷工具

App Service Diagnose and solve problems Troubleshooting categories list displaying Availability and Performance, Configuration and Management, SSL and Domains, Risk Assessments, Navigator (Preview) and Diagnostic Tools.

圖格或疑難排解連結會顯示類別的可用診斷。 如果您想要調查可用性和效能,請使用下列診斷:

  • 概觀
  • Web 應用程式關閉
  • Web 應用程式變慢
  • 高 CPU 分析
  • 記憶體分析
  • 已重新啟動 Web 應用程式
  • 應用程式變更 (預覽)
  • 應用程式損毀
  • HTTP 4xx 錯誤
  • SNAT 失敗連線端點
  • SWAP 對可用性的影響
  • TCP 連線
  • 在生產環境中測試
  • WebJob 詳細資料

App Service Diagnose and solve problems Availability and Performance category homepage, with left hand navigation containing Overview, Web App Down, Web App Slow, High CPU Analysis, Memory Analysis, Web App Restarted, Application Change (Preview), Application Crashes, HTTP 4xx Errors, SNAT Failed connection Endpoint, SNAT Port Exhaustion, Swap Effects on Availability, TCP Connections, Testing in Production, WebJob Details and the default availability dashboard for the last 24 hours of App usage, with a date and time selection interface.

診斷報告

當您選擇按一下主題進一步調查問題之後,可以檢視經常以圖形和 Markdown 補充的主題詳細資料。 診斷報告是一種功能強大的工具,可用來找出應用程式的問題。 下列為 [可用性和效能] 中的 [Web 應用程式已關閉]:

App Service Diagnose and solve problems Availability and Performance category homepage with Web App Down diagnostic selected, which displays an availability chart, Organic SLA percentage and Observations and Solutions for problems that were detected.

復原分數

若要檢閱量身打造的最佳做法建議,請參閱復原分數報告。 這是可供下載的 PDF 報告。 若要取得該報告,只要按一下任何疑難排解類別命令列上可用的 [取得復原分數報告] 按鈕即可。

App Service Diagnose and solve problems Resiliency Score report, with a gauge indicating App's resilience score and what App Developer can do to improve resilience of the App.

調查應用程式程式碼問題 (僅適用於 Windows應用程式)

因為許多應用程式問題與您應用程式程式碼中的問題相關,App Service 診斷與 Application Insights 整合,以反白顯示要與所選停機狀況相互關聯的例外狀況和相依性問題。 Application Insights 需要個別啟用。

Application Insights

若要檢視 Application Insights 例外狀況和相依性,請選取 [Web 應用程式停機] 或 [Web 應用程式緩慢] 圖格捷徑。

疑難排解步驟

如果偵測到的問題是過去 24 小時內偵測到的特定問題類別,您可以檢視完整的診斷報告,且 App Service 診斷可能會提示您檢視更多的疑難排解建議和後續步驟,以提供更具引導性質的體驗。

Application Insights and Troubleshooting and Next Steps

診斷工具

診斷工具組含更進階的診斷工具,可協助您調查應用程式程式碼問題、速度緩慢、連接字串等等。 以及主動式工具,可協助您減輕 CPU 使用量、要求和記憶體的問題。

主動式 CPU 監視 (僅適用於 Windows應用程式)

主動式 CPU 監視可讓您在應用程式的應用程式或子程序耗用高 CPU 資源時,輕鬆、主動採取動作。 您可以設定自己的 CPU 閾值規則,暫時減輕高 CPU 問題,直到發現非預期問題的實際原因為止。 如需詳細資訊,請參閱在 CPU 問題發生之前減輕 CPU 問題

Proactive CPU monitoring

自動修復

自動修復是當應用程式有非預期行為時可以採取的緩和動作。 您可以根據要求計數、慢速要求、記憶體限制和 HTTP 狀態碼來設定自己的規則,以觸發風險降低動作。 使用工具來暫時減輕非預期的行為,直到您找到根本原因為止。 此工具目前適用於 Windows Web Apps、Linux Web Apps 和 Linux 自訂容器。 支援的條件和緩和措施會因 Web 應用程式類型而異。 如需詳細資訊,請參閱在 App Service 診斷中宣佈新的自動修復體驗,以及宣佈 Linux 的自動修復體驗。

Auto-healing

主動式自動修復 (僅適用於 Windows應用程式)

如同主動式 CPU 監視,主動式自動修復是降低應用程式非預期行為的周全解決方案。 當 App Service 判斷您的應用程式處於無法復原狀態時,主動式自動修復會重新開機您的應用程式。 如需詳細資訊,請參閱主動式自動修復簡介

在具有持續整合的大型團隊中,您的應用程式有許多相依性,很難找出造成狀況不良行為的特定變更。 導覽器可藉由自動呈現應用程式與相同訂用帳戶中所有資源的相依性對應,協助您取得應用程式拓撲的可見度。 導覽器可讓您檢視應用程式及其相依性所做的變更合併清單,並縮小造成狀況不良行為的變更範圍。 您可以透過首頁圖格 [導覽器] 進行存取,而且第一次使用之前必須先加以啟用。 如需詳細資訊,請參閱使用導覽器取得應用程式相依性的可見度

Navigator default page

Diff view

您可以透過圖格快捷方式、應用程式變更應用程式損毀可用性和效能中來存取應用程式變更的變更分析,以便您可以搭配其他計量同時使用。 使用此功能之前,您必須先加以啟用。 如需詳細資訊,請參閱宣告 App Service 診斷中的新變更分析體驗

透過將「[Diag]」新增至標題,以在 UserVoice 張貼您的問題或意見反應。

更多資源

教學課程:執行負載測試以識別 Web 應用程式中的效能瓶頸