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

发布于 2024-12-11 23:40:19 字数 464 浏览 0 评论 0原文

我的页面上有几个更新面板和 jquery 选项卡。我还在更新面板上加载几个用户控件。用户等待几分钟后(未检查时间约 40 分钟)。当用户从提交按钮发送请求时出现以下错误?

'Sys.WebForms.PageRequestManagerServerErrorException:
Sys.WebForms.PageRequestManagerServerErrorException: An unknown 
error occurred while processing the request on the server. The status 
code returned from the server was: 0' when calling method: 
[nsIDOMEventListener::handleEvent]

我无法追踪这个问题来解决。但我确信。这是由 Ajax 引起的。各位高手,如果知道解决办法的话。请告诉我。

I have couple of update panels and jquery tabs on page. And also I am loading couple user controls on update panels. After user waited for couple of minutes (not checked the time approx 40 mins). when user send request from submit button it is giving below error?

'Sys.WebForms.PageRequestManagerServerErrorException:
Sys.WebForms.PageRequestManagerServerErrorException: An unknown 
error occurred while processing the request on the server. The status 
code returned from the server was: 0' when calling method: 
[nsIDOMEventListener::handleEvent]

I am not able trace this issue to fix. But I am sure. This is causing by Ajax. Gurus, if you knows solution. Please let me know.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(29

看春风乍起 2024-12-18 23:40:19

当您在多个更新面板中将控件注册为 AsyncPostbackTrigger 时,有时会出现此问题。

如果这不是问题,请尝试在脚本管理器声明之后添加以下内容,我在 中找到了该声明这篇文章,作者:manowar83,其中复制并稍微修改了 这篇文章。 asp.net/members/larryw.aspx" rel="noreferrer">larryw:

<脚本类型=“text/javascript”语言=“javascript”>
    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
    函数 EndRequestHandler(发送者,参数){
        if (args.get_error() != 未定义){
            args.set_errorHandled(true);
        }
    }

这里讨论了更多解决方案: http://forums.asp.net/ t/1066976.aspx/9/10

This issue sometimes occurs when you have a control registered as an AsyncPostbackTrigger in multiple update panels.

If that's not the problem, try adding the following right after the script manager declaration, which I found in this post by manowar83, which copies and slightly modifies this post by larryw:

<script type="text/javascript" language="javascript">
    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
    function EndRequestHandler(sender, args){
        if (args.get_error() != undefined){
            args.set_errorHandled(true);
        }
    }
</script>

There are a few more solutions discussed here: http://forums.asp.net/t/1066976.aspx/9/10

埖埖迣鎅 2024-12-18 23:40:19

我遇到了这个问题,我花了几个小时试图解决它。

勾选的解决方案不会修复错误,只会处理错误。

最好的方法是检查 IIS 日志文件,错误应该存在。更新面板似乎封装了真正的错误并将其输出为“javascript 错误”。

例如,我的错误是我忘记创建一个类[Serialized]。虽然这在本地工作得很好,但部署在服务器上时却不起作用。

I had this issue and I spent hours trying to fix it.

The solution ticked as answered will not fix the error only handle it.

The best approach is to check the IIS log files and the error should be there. It appears that the update panel encapsulates the real error and outputs it as a 'javascript error'.

For instance my error was that I forgot to make a class [Serializable]. Although this worked fine locally it did not work when deployed on the server.

面犯桃花 2024-12-18 23:40:19

当我在 UpdatePanel 的 GridView 中放置按钮时,我收到此错误...deubing 我的代码,我发现上述错误是由于另一个内部错误“从客户端检测到潜在危险的 Request.Form 值”引起

的发现页面上的一个文本框包含 XML/HTML 内容,这又导致了上述错误
当我删除 xml/HTML 并测试按钮单击时...它按预期工作。

I got this error when I had my button in the GridView in an UpdatePanel... deubbing my code I found that the above error is caused because of another internal error "A potentially dangerous Request.Form value was detected from the client"

Finally I figured out that one of my TextBoxes on the page has XML/HTML content and this in-turn causing above error
when I removed the xml/HTML and tested the button click ... it worked as expected.

策马西风 2024-12-18 23:40:19

我遇到了同样的问题,在这里我给出我的问题和我的解决方案,希望这会对某人有所帮助:

按照其他人的建议,我进入了服务器日志(在我的例子中是 Windows Server 2012):

控制面板 -> ;管理工具 ->事件查看器

然后在左侧:

Windows 日志 ->应用程序:

enter图片描述在这里

在警告中,我发现了来自我的网站的消息,在我的情况下,这是由于空引用造成的:

*Exception type: NullReferenceException 
Exception message: Object reference not set to an instance of an object.*

检查日志中描述的函数,我发现了一个未初始化的对象,就是这样。

所以这可能是代码中的空引用异常。
希望有人觉得这有用,问候。

I have got the same issue, here I give my problem and my solution hoping this would help someone:

Following other people recommendation I went to the log of the server (Windows Server 2012 in my case) in :

Control Panel -> Administrative Tools -> Event Viewer

Then in the left side:

Windows Logs -> Application:

enter image description here

In the warnings I found the message from my site and in my case it was due to a null reference:

*Exception type: NullReferenceException 
Exception message: Object reference not set to an instance of an object.*

And checking at the function described in the log I found a non initialized object and that was it.

So it could be a null reference exception in the code.
Hope someone find this useful, greetings.

夜光 2024-12-18 23:40:19

此解决方案也很有帮助:

<%@ Page 指令中添加 validateRequest="false"

这是因为 ASP.net 检查浏览器的输入是否存在危险值。更多信息请参见此链接

This solution is helpful too:

Add validateRequest="false" in the <%@ Page directive.

This is because ASP.net examines input from the browser for dangerous values. More info in this link

々眼睛长脚气 2024-12-18 23:40:19

兄弟,这段代码不是一个解决方案,只需将其更改为

<script type="text/javascript" language="javascript">
    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
    function EndRequestHandler(sender, args){
        if (args.get_error() != undefined){
            **alert(args.get_error().message.substr(args.get_error().name.length + 2));**
            args.set_errorHandled(true);
        }
    }
</script>

,您就会看到错误在那里,但您只是不将其扔到 UI 上。

Brother this piece of code is not a solution just change it to

<script type="text/javascript" language="javascript">
    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
    function EndRequestHandler(sender, args){
        if (args.get_error() != undefined){
            **alert(args.get_error().message.substr(args.get_error().name.length + 2));**
            args.set_errorHandled(true);
        }
    }
</script>

and you will see the error is there but you are just not throwing it on UI.

浮世清欢 2024-12-18 23:40:19

我也遇到了同样的问题,但这些都不起作用。就我而言,这是通过在配置文件中添加这些行来解决的。

<appSettings>
  <add key="aspnet:MaxHttpCollectionKeys" value="100000" />
</appSettings>

<system.web.extensions>
  <scripting>   
    <scriptResourceHandler enableCompression="false" enableCaching="true"/>       
  </scripting>
</system.web.extensions> 

I also faced the same issue , and none of these worked. In my case this was fixed by adding these lines in config file.

<appSettings>
  <add key="aspnet:MaxHttpCollectionKeys" value="100000" />
</appSettings>

<system.web.extensions>
  <scripting>   
    <scriptResourceHandler enableCompression="false" enableCaching="true"/>       
  </scripting>
</system.web.extensions> 
空城之時有危險 2024-12-18 23:40:19

这不是真正的问题,如果您想了解为什么会发生这种情况,请转到 IIS 的错误日志文件。

如果使用 Visual Studio,请导航至:

C:\Users\User\Documents\IISExpress\TraceLogFiles\[您的项目名称]\.

在此处按日期降序排列文件,然后打开第一个文件。

它看起来像:

在此处输入图像描述

现在向下滚动到底部以查看 GENERAL_RESPONSE_ENTITY_BUFFER
这是实际的问题。现在解决它上面的问题将自动解决。

在此处输入图像描述

This is not the real problem, if you want to see why this is happening then please go to error log file of IIS.

in case of visual studio kindly navigate to:

C:\Users\User\Documents\IISExpress\TraceLogFiles\[your project name]\.

arrange file here in datewise descending and then open very first file.

it will look like:

enter image description here

now scroll down to bottom to see the GENERAL_RESPONSE_ENTITY_BUFFER
it is the actual problem. now solve it the above problem will solve automatically.

enter image description here

森林散布 2024-12-18 23:40:19

对于使用 Visual Studio 内部 IIS 的用户,请尝试以下操作:

  1. 生成错误消息。
  2. 在错误显示处中断调试器。
  3. 检查调用堆栈。您应该看到“加注”。
  4. 双击“加注”。
  5. 检查“sender”参数的内部结构。您将看到“_xmlHttpRequest”属性。
  6. 打开“_xmlHttpRequest”属性,您将看到“response”属性。
  7. “response”属性将包含实际的消息。

我希望这对那里的人有帮助!

For those using the internal IIS of Visual Studio, try the following:

  1. Generate the error message.
  2. Break the debugger at the error display.
  3. Check the callstack. You should see 'raise'.
  4. Double click 'raise'.
  5. Check the internals of 'sender' parameter. You will see a '_xmlHttpRequest' property.
  6. Open the '_xmlHttpRequest' property, and you'll see a 'response' property.
  7. The 'response' property will have the actual message.

I hope this helps someone out there!

木槿暧夏七纪年 2024-12-18 23:40:19

检查您的应用程序 事件日志 - 我的问题是我在 Web.config 中禁用的 Telerik RadCompression HTTP 模块。

Check your Application Event Log - my issue was Telerik RadCompression HTTP Module which I disabled in the Web.config.

小帐篷 2024-12-18 23:40:19

@JS5,我也遇到了和你一样的问题:ImageButton 仅在生产服务器和 IE 上导致 UpdatePanel 内的异常。经过一番研究后我发现:

ImageButtons 和 UpdatePanels 存在问题。更新至
.NET 4.5 已修复。和微软有关系
将按钮单击的 x,y 轴从 Int 更改为 Double,以便您可以
告诉您点击按钮上的哪个位置并且它引发了转化
错误。

来源

我正在使用 NetFramework 2.0 和 IIS 6,因此建议的解决方案是降级IE 兼容性添加元标记:

<meta http-equiv="X-UA-Compatible" content="IE=9" />

我仅在我需要的页面上通过 Page_Load 方法完成此操作:

Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
    Dim tag As HtmlMeta = New HtmlMeta()

    tag.HttpEquiv = "X-UA-Compatible"
    tag.Content = "IE=9"

    Header.Controls.Add(tag)
End Sub

希望这对某人有帮助。

@JS5 , I also faced the same issue as you: ImageButton causing exceptions inside UpdatePanel only on production server and IE. After some research I found this:

There is an issue with ImageButtons and UpdatePanels. The update to
.NET 4.5 is fixed there. It has something to do with Microsoft
changed the x,y axis of a button click from Int to Double so you can
tell where on the button you clicked and it's throwing a conversion
error.

Source

I'm using NetFramework 2.0 and IIS 6, so, the suggested solution was to downgrade IE compatibility adding a meta tag:

<meta http-equiv="X-UA-Compatible" content="IE=9" />

I've done this via Page_Load method only on the page I needed to:

Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
    Dim tag As HtmlMeta = New HtmlMeta()

    tag.HttpEquiv = "X-UA-Compatible"
    tag.Content = "IE=9"

    Header.Controls.Add(tag)
End Sub

Hope this helps someone.

绝不服输 2024-12-18 23:40:19

我遇到了同样的问题,当我尝试解决它的方法时,我发现更新面板导致了这个问题。根据我的要求,我可以删除更新面板并解决问题。
所以这是这个问题的一个可能的解决方案。

I had the same issue, when i was trying out a way to solve it, i found out that the update panel was causing this issue. Depending on my requirement i could remove the update panel and get rid of the issue.
So it's a possible solution for the issue.

甜心 2024-12-18 23:40:19

我们也遇到了同样的问题,并且该问题只能在服务器中重现(即不能在本地重现,这使得修复更加困难,因为我们无法调试应用程序)以及使用 IE 时。我们有一个带有更新面板的页面,在这个更新面板中有一个 modalpopupextender,其中也包含一个更新面板。在尝试了几种不起作用的解决方案后,我们通过用链接按钮替换 modalpopupextender 中的每个图像按钮以及其中所需的图像来修复它。

We also faced the same issue, and the problem could only be reproduced in the server (i.e., not locally, which made it even harder to fix, because we could not debug the application), and when using IE. We had a page with an update panel, and within this update panel a modalpopupextender, which also contained an update panel. After trying several solutions that did not work, we fix it by replacing every imagebutton within the modalpopupextender with a linkbutton, and within it the image needed.

梦旅人picnic 2024-12-18 23:40:19

在 updatepanel 中使用下面的代码。

<script type="text/javascript" language="javascript">
    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
    function EndRequestHandler(sender, args){
        if (args.get_error() != undefined){
            args.set_errorHandled(true);
        }
    }
</script>

Use the following code below inside updatepanel.

<script type="text/javascript" language="javascript">
    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
    function EndRequestHandler(sender, args){
        if (args.get_error() != undefined){
            args.set_errorHandled(true);
        }
    }
</script>
×纯※雪 2024-12-18 23:40:19

对我来说,问题是我使用的是

For me the problem was that I was using a <button> instead of a <asp:LinkButton>

燕归巢 2024-12-18 23:40:19

有时,由于某些代码,您会在文本字段中获得 HTML 标记,就像我用 HTML 的新行 BR 标记替换一些字符一样,我也错误地在应该显示在多行文本框中的文本中替换了它,所以由于我的字符串替换功能,我的多行文本框中有一个新行 HTML 标记 BR 动态出现,我开始收到此 JavaScript 错误,并且由于此 HTML 代码显示在更新面板中的文本框中,我开始收到此错误所以我进行了更正,一切都很好。因此,在复制粘贴任何内容之前,请查看您的代码,并确保所有标签均已正确关闭,并且文本框或下拉列表中没有不相关的代码数据。此错误总是由于格式不正确的标签和不相关的数据而引起。

Some times due to some code you get HTML tags in a text filed, like I was replacing some characters with new line BR tag of HTML and by mistake I also replaced it in the text that was supposed to be displayed in a Multiline text box so my multiline text box had a new line HTML tag BR in it coming dynamically due to my string replace function and I started getting this JavaScript error and as this HTML code was displayed in a text box that was in an update panel I start getting this error so I made the correction and all was fine. So before copying pasting anything please look at your code and see that all tag are closed proper and no irrelevant code data is coming to text boxes or Drop down lists. This error always come due to ill formed tags and irrelevant data.

自此以后,行同陌路 2024-12-18 23:40:19

我对此的解决方法是删除更新面板内的 asp.net 代码中 TextBox 的 Text="" 属性中的任何 HTML 标记。如果页面上有多个更新面板,则会影响所有更新面板,这使得找出哪个面板出现问题变得更加困难。克里斯上面的答案引导我找到了这一点,但他是一个非常隐藏的答案,但我认为这是一个非常相关的答案,所以这里有一个解释的答案。

<asp:TextBox ID="bookingTBox" runat="server" ToolTip="" Width="150px" Text="<Auto Assigned>" CssClass="textboxItalicFormat"></asp:TextBox>

上面的代码会报这个错误。

下面的不会。

<asp:TextBox ID="bookingTBox" runat="server" ToolTip="" Width="150px" Text="Auto Assigned" CssClass="textboxItalicFormat"></asp:TextBox>

在第二个文本框代码中,我删除了 <和>来自 Text="" 属性。请在花时间添加脚本代码行等之前尝试一下。

My fix for this was to remove any HTML markup that was in the Text="" property of a TextBox in my asp.net code, inside an update panel. If you have more than one update panel on a page, it will affect them all, which makes it harder to work out which panel has the issue. Chris's answer above lead me to find this, but his is a very hidden answer but I think a very relevant one so here is an answer explained.

<asp:TextBox ID="bookingTBox" runat="server" ToolTip="" Width="150px" Text="<Auto Assigned>" CssClass="textboxItalicFormat"></asp:TextBox>

The above code will give this error.

The below will not.

<asp:TextBox ID="bookingTBox" runat="server" ToolTip="" Width="150px" Text="Auto Assigned" CssClass="textboxItalicFormat"></asp:TextBox>

In the second textbox code I have removed the < and > from the Text="" property. Please try this before spending time adding lines of script code, etc.

瑕疵 2024-12-18 23:40:19

在 iFrame 中使用 AsyncFileUploader 时遇到此问题。使用firefox时出现错误。在镀铬下工作得很好。似乎父页面或 iframe 页面加载不同步,并且父页面找不到 iframe 页面上的控件。添加了一个简单的 JavaScript 警报来表明文件已上传。这为控件提供了足够的时间来加载,并且由于控件可用,所以加载的所有内容都没有错误。

Had this problem when using AsyncFileUploader in an iFrame. Error came when using firefox. Worked in chrome just fine. It seemed like either the parent page or iframe page was loading out of sync and the parent page could not find the controls on the iframe page. Added a simple javascript alert to say that the file was uploaded. This gave the controls enough time to load and since the controls were available, everything loaded without an error.

遮了一弯 2024-12-18 23:40:19

当我将项目升级到 4.5 框架并且 GridView 具有空数据模板时,我遇到了这个问题。有些事情发生了变化,以下之前返回空数据模板的语句现在返回标题行。

GridViewRow dr = (GridViewRow)this.grdViewRoleMembership.Controls[0].Controls[0];

我将其更改为下面的错误,并且 GridView 开始按预期工作。

GridViewRow dr = (GridViewRow)this.grdViewRoleMembership.Controls[0].Controls[1];

我希望这对某人有帮助。

I had this issue when I upgraded my project to 4.5 framework and the GridView had Empty Data Template. Something changed and the following statement which previously was returning the Empty Data Template was now returning the Header Row.

GridViewRow dr = (GridViewRow)this.grdViewRoleMembership.Controls[0].Controls[0];

I changed it to below and the error went away and the GridView started working as expected.

GridViewRow dr = (GridViewRow)this.grdViewRoleMembership.Controls[0].Controls[1];

I hope this helps someone.

相权↑美人 2024-12-18 23:40:19

对我来说,这个问题是由数据库映射错误引起的。

我尝试对数据源使用 select() 调用,但后面的代码出现错误。我的控件位于更新面板内,实际原因被隐藏。

通常,如果您可以暂时删除更新面板,asp.net 将返回更有用的错误消息。

This issue for me was caused by a database mapping error.

I attempted to use a select() call on a datasource with errors in the code behind. My controls were within an update panel and the actual cause was hidden.

Usually, if you can temporarily remove the update panel, asp.net will return a more useful error message.

她说她爱他 2024-12-18 23:40:19

" 1- 转到应用程序的 web.config "

" 2- 在下添加新条目 "

3-还找到页面标签并设置 validateRequest=False

只有这对我有用。 !!

" 1- Go to the web.config of your application "

" 2- Add a new entry under < system.web > "

3- Also Find the pages tag and set validateRequest=False

Only this works for me. !!

望喜 2024-12-18 23:40:19

当 CDN 为根目录时,请务必添加波浪号和正斜杠(~/)。我认为这是IIS的问题

Be sure to put tilde and forward slash(~/) when CDN is the root directory. I think it's an issue in IIS

因为看清所以看轻 2024-12-18 23:40:19

正如我的朋友 @RaviKumar 上面提到的,以下问题的一个原因是从代码传输到 UI 的某些数据包含原始 html 标签,这使得请求无效,例如我有一个 textarea ,在我的代码中我有通过下面的代码设置其值

txtAgreement.Text = Data.Agreement

当我编译页面时,我可以在 textarea 中看到原始 html 标签,因此我将 textarea 更改为 div innerhtml 可以工作并渲染 html(而不是将原始 html 标签注入到元素中),它对我来说是

快乐的编码

as my friend @RaviKumar mentioned above one reason of following problem is that some piece of data transferred from code to UI contain raw html tags which make request invalid for example I had a textarea and in my code I had set its value by code below

txtAgreement.Text = Data.Agreement

And when I compiled the page I could see raw html tag inside textarea so I changed textarea to div on which innerhtml works and render html (instead of injecting raw html tags into element) and it worked for me

happy coding

掌心的温暖 2024-12-18 23:40:19
<add key="aspnet:MaxHttpCollectionKeys" value="100000"/ >

将以上密钥添加到 Web.config 或 App.config 以消除此错误。

<add key="aspnet:MaxHttpCollectionKeys" value="100000"/ >

Add above key to Web.config or App.config to remove this error.

好倦 2024-12-18 23:40:19

当我在更新面板中使用 ModalPopupExtender 时,我收到此错误...deubing 我的代码,我发现上述错误是由于 updatepanel updatemode 是有条件的而引起的...所以我将其更改为始终,然后问题就解决了。

I got this error when I had ModalPopupExtender in the update panel... deubbing my code I found that the above error is caused because of updatepanel updatemode is conditional... so i change it to always then problem is solved.

楠木可依 2024-12-18 23:40:19

这在我的代码中运行良好..我解决了我的问题..确实

web.config 文件中添加以下代码。

<system.web>
    <httpRuntime executionTimeout="999" maxRequestLength="2097151"/>
</system.web>

This was working fine in my code.. i solved my issue.. really

Add below code in web.config file.

<system.web>
    <httpRuntime executionTimeout="999" maxRequestLength="2097151"/>
</system.web>
左岸枫 2024-12-18 23:40:19

我的答案是修复一个 gridview 控件,其中包含一个模板字段,该字段有一个下拉列表,其中加载了巨大数量的可选项目 - 我用一个标签字段替换了 DDL,该标签字段的数据是从功能。 (我原本打算允许 gridview 编辑,但已切换为允许在单独的面板上进行编辑,该面板只显示该记录的该字段的 DDL)。希望这可以帮助某人。

answer for me was to fix a gridview control which contained a template field that had a dropdownlist which was loaded with a monstrous amount of selectable items- i replaced the DDL with a label field whose data is generated from a function. (i was originally going to allow gridview editing, but have switched to allowing edits on a separate panel displaying the DDL for that field for just that record). hope this might help someone.

不爱素颜 2024-12-18 23:40:19

此错误:未捕获的 Sys.WebForms.PageRequestManagerServerErrorException ....
当 Oracle 由于 sql 命令中的列/表拼写错误而出现异常时,我进入了一个 UpdatePanel 的后端逻辑......

This error: Uncaught Sys.WebForms.PageRequestManagerServerErrorException ....
i got in backend logic of one UpdatePanel when Oracle made exception because of mispelled column/table in sql command....

如痴如狂 2024-12-18 23:40:19

就我而言,它与 web.config 中的 scriptResourceHandler 压缩有关
我设置为 false,现在看起来工作正常。

In my case it was related with scriptResourceHandler compression in web.config
I set to false and it looks working fine now.

<system.web.extensions>

</system.web.extensions>

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文