抛出了类型'System.OutOfMemoryException'的异常.

Adh*_*ham 24 vb.net asp.net out-of-memory

我遇到了以下问题

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.]
   System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
   System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks) +567
   System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +192
   System.Reflection.Assembly.Load(String assemblyString) +35
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +123

[ConfigurationErrorsException: Exception of type 'System.OutOfMemoryException' was thrown.]
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +11569328
   System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +485
   System.Web.Configuration.AssemblyInfo.get_AssemblyInternal() +79
   System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +337
   System.Web.Compilation.BuildManager.CallPreStartInitMethods() +280
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +1167

[HttpException (0x80004005): Exception of type 'System.OutOfMemoryException' was thrown.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11702064
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4870277
Run Code Online (Sandbox Code Playgroud)

我没有更改代码?什么是这个问题意味着,因为我看到没有更多关于错误的声明

Nis*_*sha 31

当某些进程(例如将大量数据加载到内存流和系统内存)无法存储大量数据时,通常会发生此问题.尝试通过命令清除临时文件夹

开始 - >运行 - >%temp%

  • 读这个.这篇文章太棒了!http://blogs.iis.net/webtopics/archive/2009/05/22/troubleshooting-system-outofmemoryexceptions-in-asp-net.aspx (5认同)

小智 12

在调试模式下运行

在开发和调试应用程序时,通常会将web.config文件中的debug属性设置为true,并以调试模式编译DLL.但是,在将应用程序部署到测试或生产之前,应该在发布模式下编译组件并将debug属性设置为false.

在调试模式下运行时,ASP.NET在许多级别上的工作方式不同 实际上,当您在调试模式下运行时,GC将允许您的对象保持更长时间(直到示波器结束),因此在调试模式下运行时,您将始终看到更高的内存使用量.

在调试模式下运行的另一个常见的未实现副作用是通过webresource.axd和scriptresource.axd处理程序提供的客户端脚本不会被缓存.这意味着每个客户端请求都必须下载任何脚本(例如ASP.NET AJAX脚本),而不是利用客户端缓存.这可能会导致性能大幅下降.

资料来源:http://blogs.iis.net/webtopics/archive/2009/05/22/troubleshooting-system-outofmemoryexceptions-in-asp-net.aspx


Dij*_*aaf 12

另一件事是尝试

工具 - >选项 - >搜索IIS - > tick 将64位版本的IIS Express用于网站和项目.

使用64位版本的IIS Express进行网站和项目截图


Kri*_*ews 6

如果您使用的是 IIS Express,请Show All Application从任务栏通知区域的 IIS Express 中选择,然后选择Stop All

现在重新运行您的应用程序。


som*_*eek 6

我刚刚重启了Visual Studio并完成了IISRESET,解决了这个问题.