Dotnet 7服务进程僵死无法处理请求的根因排查
.NET 7服务僵死:
Microsoft.AspNetCore.Http.Features程序集加载失败问题分析 问题场景
原本运行正常的.NET 7服务突然持续记录以下错误日志,服务进程仍在运行但无法处理任何请求,处于僵死状态,重启进程后恢复正常:
Category: Microsoft.AspNetCore.Server.Kestrel EventId: 0 ConnectionId: 0HMUL71ECIOGR Unhandled exception while processing 0HMUL71ECIOGR. Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.AspNetCore.Http.Features, Version=7.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified. File name: 'Microsoft.AspNetCore.Http.Features, Version=7.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.HttpConnection.ProcessRequestsAsync[TContext](IHttpApplication`1 httpApplication) at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.HttpConnection.ProcessRequestsAsync[TContext](IHttpApplication`1 httpApplication) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure.KestrelConnection`1.ExecuteAsync()
根本原因分析
- 程序集文件丢失/损坏:服务器上的
Microsoft.AspNetCore.Http.Features.dll文件可能被意外删除、磁盘IO错误导致损坏,或被安全工具误清理。该程序集是Kestrel处理HTTP请求的核心依赖,缺失后请求处理流程直接中断。 - 程序集加载缓存异常:.NET运行时的程序集加载缓存(如Native Image Cache、Assembly Load Context)出现损坏或不一致。运行时尝试从缓存加载程序集失败,重启进程会重置加载上下文,重新从磁盘读取程序集,从而恢复服务。
- 文件权限变更:服务运行账户对
Microsoft.AspNetCore.Http.Features.dll所在目录的读取权限被移除,导致运行时无法访问该文件。这种情况通常由运维操作、系统更新等导致权限意外变更。 - 依赖版本冲突/覆盖:服务器上其他.NET应用部署时,可能覆盖了全局程序集缓存(GAC)或共享目录中的目标版本程序集,引发版本不匹配。重启后可能临时恢复,但后续仍可能再次触发冲突。
内容的提问来源于stack exchange,提问作者Madushan
相关产品推荐
相关产品推荐

