Sys.WebForms.PageRequestManagerServerErrorException 12031

时间:2008-10-27 12:05:06

标签: asp.net asp.net-ajax exception-handling

我偶尔会从AJAX.NET应用程序中获取以下弹出窗口

Sys.WebForms.PageRequestManagerServerErrorException: An Unknown error occurred while processing the request on the server. The status code returned from the server was: 12031

Microsoft kb状态代码指示ERROR_INTERNET_CONNECTION_RESET,但它没有说明首先触发错误的根本问题是什么。

如何记录/跟踪/ etc生成弹出窗口的基础错误?

6 个答案:

答案 0 :(得分:21)

如果您是从updatePanel获取的,请在ScriptManager中为页面设置EnablePartialRendering为false,然后它会给您实际的错误。

此外,如果只是偶尔发生,我发现它可能是一个viewstate问题,特别是当页面在刷新之间长时间(20分钟左右)时。

否则,尝试一些try / catch块。这些是一些简单的方法。

希望有所帮助!

答案 1 :(得分:15)

这是一个观点问题,但与时间无关,但与大小无关。尝试在web.config中使用maxRequestLength。

答案 2 :(得分:1)

我在UpdatePanel中遇到此错误,并且在更改下拉列表选择之间出现大延迟(> 20分钟)后自动停止下拉。

尝试在web.cofig中增加会话超时。例如:

<sessionState mode="InProc" cookieless="true" timeout="720"/>;

答案 3 :(得分:1)

添加 <httpRuntime requestValidationMode="2.0"/>
 在 web.config 中 并在 YourPage.aspx 设置(ClientIDMode =“Static”ValidateRequest =“false”)

::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::

示例:web.config

   <?xml version="1.0"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <system.web>
    <httpRuntime requestValidationMode="2.0"/>
    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
      </assemblies>
    </compilation>

  </system.web>


  <connectionStrings>
    <add name="WT_ZadnjiEntities" connectionString="metadata=res://*/DAL.Model.csdl|res://*/DAL.Model.ssdl|res://*/DAL.Model.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=SATELLITE-PC;initial catalog=WT_Zadnji;integrated security=True;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>
</configuration>

答案 4 :(得分:0)

如果您添加了服务器SSL证书(https),有时会出现错误。如果证书无效,则会出现此错误。

答案 5 :(得分:0)

我在回发时发生了以下错误:

  

错误:Sys.WebForms.PageRequestManagerServerErrorException:在服务器上处理请求时发生未知错误。

但对我来说,问题是我正在将我的项目从ASP.NET 2.0转换为ASP.NET 4.0,并且我在页面上使用了<asp:UpdatePanel runat="server">

我取消<asp:UpdatePanel runat="server">(暂时),然后运行页面以获得确切的错误。这是“检测到潜在危险的Request.Form值”

我发现即使页面上有ValidateRequest="false",ASP.NET 4.0也要求您在web.config的HttpRuntime标记中添加requestValidationMode="2.0"

<httpRuntime maxRequestLength="102400" requestValidationMode="2.0"/>

Reference