【Azure App Service】分享App Service for Window中自动抓取Memory DUMP的方法

问题描述

当应用部署到Azure App Service后,如果突然遇见应用内存上升的情况,如果想 第一时间的抓取Memory DUMP,以便于分析出内存占用到上限值的根源,有什么好的办法呢?

问题解答

如果是 Windows App Service,最简单的做法是开启 Auto-Heal:触发条件选内存上限,动作选 Collect a Memory Dump。进程私有内存超过阈值时,系统会自动抓 dump。

Auto-Heal provides you with an easy way to take an action when your app is having an unexpected behavior. The triggers and actions allow you to define various conditions based on request count, slow requests, memory limit on which you can take specific actions like restarting the process, logging an event, or starting another executable. Please note that these mitigations should only be considered a temporary workaround until you find the real cause for the issue causing the unexpected behavior.

具体的操作步骤如下:

  1. 打开 Azure Portal,进入目标 Web App。
  2. 依次点 Network → Troubleshoot → Auto-Heal。
  3. 打开 Custom Auto-Heal Rules(自定义自动修复规则)。
  4. Conditions(触发条件):选 Memory Limit,填内存阈值。这个值指的是单个实例上 w3wp 进程的 Private Bytes。
  5. Actions(动作):选 Custom Action → Collect a Memory Dump。
    • 可以选抓完 dump 后是否同时分析,或是否重启进程(Kill)。
    • 如果门户提示配置存储账户,就按提示绑定一个。dump 会写到那个存储账户里。
  6. Override when action executes(最短运行时间):建议设成 5--10 分钟,防止进程刚启动就反复触发。
  7. 点 Save。保存后站点会重启一次,规则才会生效。

操作步骤截图参考:

参考资料

Auto Healing Experience in App Service Diagnostics :Announcing the New Auto Healing Experience in App Service Diagnostics - Azure App Service


当在复杂的环境中面临问题,格物之道需:浊而静之徐清,安以动之徐生。 云中,恰是如此!

相关推荐
En^_^Joy1 天前
LangChain消息系统全解析:从基础到实战(四)
数据库·microsoft·langchain
宝桥南山2 天前
Visual Studio - 记录一个Visual Studio 2026(Insiders)的更新问题
windows·microsoft·微软·.net·.netcore·visual studio
csdn_aspnet3 天前
使用 Docker 运行 Microsoft SQL 数据库服务器
数据库·microsoft·docker·sqlserver
csdn_aspnet4 天前
生产环境中 SQL Server 的 Docker 使用建议
运维·microsoft·docker·容器·sqlserver
csdn_aspnet4 天前
如何在 Docker 上安装 SQL Server
运维·microsoft·docker·容器·sqlserver
宝桥南山6 天前
Visual Studio 2026新特性 - 可以直接连接DeepSeek(使用Custom Endpoint Provider配置项)
ide·microsoft·微软·aigc·.net·visual studio
轻松,带微笑7 天前
AI竞争进入下半场:微软押注专业模型,通用大模型不再是唯一答案
人工智能·microsoft
峥嵘life7 天前
Android16 热点「网络共享」开关的设计与实现
服务器·网络·microsoft
奇树谦8 天前
UML 时序图(Sequence Diagram)详解:从基础概念到实际项目应用
microsoft·uml
2601_967980119 天前
Python 与云计算:AWS、GCP、Azure 实践
python·云计算·azure·aws·gcp