误差部分回发 [英] Error with partial postbacks

查看:125
本文介绍了误差部分回发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我的应用程序的问题。 Web应用程序是相当大的,并通过使用若干ASCX和VB服务器控制,其每一个确实使用更新面板各种局部交背上的工作原理。一切正常我的本地机器上,但是当我把我的应用程序服务器(IIS)我注意到一个更新面板的更新时我的应用程序将抛出一个错误。以下是错误:

I am having an issue with my application. The web application is quite large and works by using a number of ascx and VB server controls, each of which does various partial post backs using update panels. Everything works fine on my local machine but when I push my application to the server (IIS) I notice that my application will throw an error during an update of an update panel. Here is the error:

Sys.WebForms.PageRequestManagerServerErrorException: Object reference not set to an instance of an object.

我不知道是什么原因造成这个错误,或者如何跟踪哪个控件导致此问题。我试着调试使用IE的开发工具现场应用。错误似乎是从网络资源,MicrosoftAjaxWebForms.debug.js始发。是有问题的功能是:

I'm not sure what is causing this error or how to track down which control is causing this problem. I've tried debugging the live application using IE's Developer Tools. The error seems to be originating from a web resource, MicrosoftAjaxWebForms.debug.js. The function that is having the problem is:

_endPostBack: function PageRequestManager$_endPostBack(error, executor, data) {
    if (this._request === executor.get_webRequest()) {
        this._processingRequest = false;
        this._additionalInput = null;
        this._request = null;
    }

    var eventArgs = new Sys.WebForms.EndRequestEventArgs(error, data ? data.dataItems : {}, executor);
    Sys.Observer.raiseEvent(this, "endRequest", eventArgs);
    if (error && !eventArgs.get_errorHandled()) {
        throw error;
    }
},

数据变量跨为空来。任何人都知道如何解决这个问题,或者如何找出明确我的网页上控制导致了问题?

The data variable is coming across as null. Anyone know how to address this problem or how to find out specifically which control on my page is causing the issue?

感谢您的帮助
杰森

Thanks for any help Jason

推荐答案

这其实对我来说是很好的经验教训。应用程序和我看到的问题的一些背景知识。我决定创建一个将使用更新面板尽可能多的,以创建一个漂亮的流动应用程序的应用程序。就这样,我想为这会令他们觉得一切都已经同步没有回发或页面传输用户的体验。该应用程序是我们公司和也被本地Intranet上运行。

This was actually a good "lessons Learned" for me. A little background on the application and the problem I was seeing. I decided I wanted to create an application that would use update panels as much as possible, to create a nice flowing application. In this way, I wanted to create an experience for the user that would make them think everything was synchronous had had no post backs or page transfers. The application was for our company and was also running on a local Intranet.

要帮助做到这一点,我爆发了我的应用程序的每个组成部分,并创立了自己的服务器控件。例如,我有一组添加到包括与GridView的,按钮等上一个模式对话框的一个单用户控件(ASCX)控制。为了让来来往往的所有数据的跟踪,每个控制一直在跟踪会话它自己的数据。在大多数情况下,这个数据在会议是对象的列表。作为应用程序增长(即,随着用户使用的应用程序,则会话将增长)我会得到间歇性错误。这些错误只有当我被推出来到我们的服务器,但调试和我的本地IIS服务器上的本地细跑的发生。错误我花了几天的追查,但最终成为一个对象将被被关在会议上偶尔会得到丢失。

To help do this, i broke out each component of my application and created its own server control. For example, I had a group of controls added to one single user control (ASCX) that consisted of a modal dialog with gridviews, buttons, etc on it. To keep track of all the data coming and going, each control kept track of it's own data in session. For the most part, this data in the sessions were lists of objects. As the application grew (that is to say, as the user used the application, the sessions would grow) I would get intermittent errors. These errors only occurred when I pushed it out to our server but ran fine locally in debug and on my local IIS server. The error took me a few days to track down but ended up being an object would that was being kept in session would sporadically get "lost".

事实证明,我们的IIS对内存大小上限。一旦上限达成,IIS的应用程序池将重新启动,从而导致所有的会话进行复位。因为我已经封顶这没有发生局部。所以,我不得不重新思考数据是如何被持久化。最后我用视图状态的大部分我的数据(这要求类被序列化)。我确实有不能使用视图状态,不得不依靠会话控制。对于这一个,我确信我添加了一个可以被称为清除掉所有的会话数据时,不再需要它的方法。

As it turned out, our IIS had a cap on in memory size. Once that cap was reached, IIS's App Pool would be restarted, causing all session to be reset. This did not occur locally because I had to cap. So, I had to re-think how data was being persisted. I ended up using view states for most of my data (which requires that the classes be serialized). I did have a control that could not use view states and had to rely on sessions. For this one, I made sure i added a method that could be called to clear out all session data when it was no longer needed.

在未来,我想我会做一些不同的事情。首先,与我使用会话更明智。我不知道是否有对视图状态的任何限制,但我还没有遇到任何问题。我想我会从更新面板(Ajax控件loolkit一起)远离,并依靠正阿贾克斯。其次,虽然更新面板使快速发展的成本较重的部分回发。

In the future, I think I will do a few things differently. First, be more judicious with my use of Sessions. I'm not sure if there are any limitations on view states, but I have not yet experiences any issues. I also think I will stay away from update panels (the ajax control loolkit all together) and rely on regular ajax. Second, while update panels make for fast development the cost is heavier partial postbacks.

这篇关于误差部分回发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆