asp.net-2.0 - 生产服务器系统内存不足异常

标签 asp.net-2.0

我们在生产服务器上安装了 .net 应用程序。它在 RAM 为 4 GB 的 Windows Server 2003 上使用 .net FrameWork 3.0。 但是应用程序在运行时存在问题,有时会抛出系统内存不足异常。我对此感到非常沮丧。我也无法模拟这个问题。我检查了所有可能导致问题的可能性,但没有得到任何解决问题的方法

我检查了生产服务器事件日志,发现内存不足异常以及无效 View 状态日志。 查看以下事件日志,这可能有助于找到解决方案。

Exception information: 
    Exception type: HttpException 
    Exception message: Invalid viewstate. 
Request information: 
    Request path: /zContest/ScriptResource.axd 
    User: LisaA 
    Is authenticated: True 
    Authentication Type: Forms 

Thread information: 
    Thread ID: 10 
    Is impersonating: True 
    Stack trace:    at System.Web.UI.Page.DecryptStringWithIV(String s, IVType ivType)
   at System.Web.UI.Page.DecryptString(String s)
   at System.Web.Handlers.ScriptResourceHandler.DecryptParameter(NameValueCollection queryString)
   at System.Web.Handlers.ScriptResourceHandler.ProcessRequestInternal(HttpResponse response, NameValueCollection queryString, VirtualFileReader fileReader)
   at System.Web.Handlers.ScriptResourceHandler.ProcessRequest(HttpContext context)
   at System.Web.Handlers.ScriptResourceHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext context)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------
Event code: 3005 
Event message: An unhandled exception has occurred. 
Process information: 
    Process ID: 5388 
    Process name: w3wp.exe  
Exception information: 
    Exception type: OutOfMemoryException 
    Exception message: Exception of type 'System.OutOfMemoryException' was thrown. 
------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------

请帮我解决这个问题

最佳答案

我发现这是一个与分配给大对象堆和应用程序池内存回收设置的 IIS 上的 .NET 内存管理相关的问题。

在物理内存为 1GB 或更少的 32 位服务器上,服务器将默认内存回收率为物理内存使用量的 60%,即大约 600MB。超过 600MB 时,您会注意到 outofmemoryexceptions 显着增加,这是 Microsoft 自己承认的。

http://msdn.microsoft.com/en-us/library/ms972959.aspx

A memory limit of 60% of physical RAM is recommended to avoid paging, especially when a new process replaces the old one due to excessive memory consumption. ..... It is important to adjust the memory limit on machines with large amounts of physical RAM, so that the cache memory manager and process recycling function properly. For example, assume you have a server with 4 gigabytes (GB) of physical RAM that is using the default memory limit. This is a problem. Sixty percent of physical RAM is 2.4 GB, which is larger than the default virtual address space of 2 GB. So what should the memory limit be set to? ...... There are a couple things to consider: First, the likelihood of experiencing an OutOfMemoryException begins to increase dramatically when "Process\Virtual Bytes" is within 600 MB of the virtual address space limit (generally 2 GB),

对于 1GB 的物理内存,默认设置就可以了,但是对于大于 1GB 的物理内存,您将需要对应用程序池内存回收设置进行一些调整或更改适当的配置数据库设置。

其他相关文章:

关于asp.net-2.0 - 生产服务器系统内存不足异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1791812/

相关文章:

asp.net - 如何在不使用 Visual Studio 的情况下在 ASP.Net 2.0 中包含 Anti-XSS

asp.net - ASP.NET 页面中的 `CodeFile` 属性有什么用

asp.net - 回发破坏了我的 GridView 列中的用户控件

asp.net-2.0 - ASP.NET 2.0 : Specifying an instance of an object for an ObjectDataSource

c# - 从 Web.Config 引用命名空间

ASP.NET 中的 JavaScript 事件处理程序

c# - 如何找到 ASP.Net 网站中的死锁

ASP.net 自定义 GridView 控件

asp.net - 如何使用 https 保护网站

vb.net - 如何将数据读取器转换为数据表