首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >我的一个.aspx页面显示错误消息:抛出了'System.OutOfMemoryException‘类型的异常

我的一个.aspx页面显示错误消息:抛出了'System.OutOfMemoryException‘类型的异常
EN

Stack Overflow用户
提问于 2018-08-31 07:52:24
回答 1查看 1.1K关注 0票数 0

在我的ViewProducts.aspx中,我有一个基于SELECT * FROM ProductGridviewProduct表有553行。

因此,现在当我尝试显示ViewProducts.aspx页面时,我得到以下错误:

说明:当前web请求执行过程中发生未处理异常。请查看堆栈跟踪,以了解有关错误的更多信息以及错误在代码中的来源。

异常详细信息: System.OutOfMemoryException:引发了'System.OutOfMemoryException‘类型的异常。

源错误:

在执行当前web请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪来识别有关异常的来源和位置的信息。

堆栈跟踪:

OutOfMemoryException:引发了'System.OutOfMemoryException‘类型的异常。System.IO.MemoryStream.set_Capacity(Int32值) +89 System.IO.MemoryStream.EnsureCapacity(Int32值) +90 System.IO.MemoryStream.Write(Byte[]缓冲器,Int32偏移量,Int32计数) +326 Microsoft.VisualStudio.Web.PageInspector.Runtime.Tracing.ArteryFilter.Write(Byte[]缓冲器,finalFiltering偏移量,Int32计数) +62 System.Web.HttpWriter.FilterIntegrated(Boolean finalFiltering,布尔wr) +9871464 System.Web.CallFilterExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +58 System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep步长+48 System.Web.HttpApplication.ExecuteStep(IExecutionStep步长,布尔值& completedSynchronously) +71

这是我的web.config文件:

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <configSections>
        <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    </configSections>
    <connectionStrings>
        <add name="DefaultConnection" 
             connectionString="Data source=LAPTOP-ODS96MIK\\MSSQL2014; database = Grocery_Demo; integrated security=SSPI"
             providerName="System.Data.SqlClient" />
        <add name="Grocery_DemoConnectionString" 
             connectionString="Data Source=LAPTOP-ODS96MIK\MSSQL2014;Initial Catalog=Grocery_Demo;Integrated Security=True"
             providerName="System.Data.SqlClient" />
    </connectionStrings>
    <system.web>
        <authentication mode="None" />
        <compilation debug="true" targetFramework="4.5.2" />
        <httpRuntime maxRequestLength="1048576" executionTimeout="3600" targetFramework="4.5.2" />
        <pages>
            <namespaces>
                <add namespace="System.Web.Optimization" />
                <add namespace="Microsoft.AspNet.Identity" />
            </namespaces>
            <controls>
                <add assembly="Microsoft.AspNet.Web.Optimization.WebForms" namespace="Microsoft.AspNet.Web.Optimization.WebForms" tagPrefix="webopt" />
            </controls>
        </pages>
        <membership>
            <providers>
                <clear />
            </providers>
        </membership>
        <profile>
            <providers>
                <clear />
            </providers>
        </profile>
        <roleManager>
            <providers>
                <clear />
            </providers>
        </roleManager>
        <sessionState mode="InProc" customProvider="DefaultSessionProvider">
            <providers>
                <add name="DefaultSessionProvider" 
                     type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" 
                     connectionStringName="DefaultConnection" />
            </providers>
        </sessionState>
    </system.web>
    <system.webServer>
        <security>
            <requestFiltering>
                <requestLimits maxAllowedContentLength="1073741824" />
            </requestFiltering>
        </security>
        <modules>
            <remove name="FormsAuthentication" />
        </modules>
    </system.webServer>
    <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
                <assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" />
                <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="WebGrease" culture="neutral" publicKeyToken="31bf3856ad364e35" />
                <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="EntityFramework"  publicKeyToken="b77a5c561934e089" />
                <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="Microsoft.Owin" culture="neutral" publicKeyToken="31bf3856ad364e35" />
                <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="Microsoft.Owin.Security.OAuth" culture="neutral" publicKeyToken="31bf3856ad364e35" />
                <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
            </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Owin.Security.Cookies" culture="neutral" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Owin.Security" culture="neutral" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
        </dependentAssembly>
    </assemblyBinding>
    </runtime>
    <entityFramework>
        <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
            <parameters>
                <parameter value="mssqllocaldb" />
            </parameters>
         </defaultConnectionFactory>
         <providers>
             <provider invariantName="System.Data.SqlClient" 
                       type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
        </providers>
    </entityFramework>
    <system.codedom>
        <compilers>
            <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" />
           <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />
        </compilers>
    </system.codedom>
</configuration>

我确认显示错误消息的原因之一是ViewProducts.aspx页面试图显示553行的网格视图,这超出了系统的容量。

但是,我不确定我必须在web.config文件中进行哪些确切的更改。

如果提供推荐的建议或解决方案,将会很有帮助。

EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52106785

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档