异步任务_dlgt.EndInvoke(ar)对象引用未设置为对象的实例

时间:2012-09-07 14:45:10

标签: asp.net asynchronous object-reference iasyncresult

我正在开发一个需要执行异步任务的应用程序。 我使用了http://msdn.microsoft.com/fr-fr/library/system.web.ui.page.executeregisteredasynctasks.aspx

给出的代码的两倍

我只需将其复制并粘贴到我的应用程序中即可。 不幸的是,我有一次错误,而另一次完美无缺。

错误是:

Object reference not set to an instance of an object. 
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.NullReferenceException: Object reference not set to an instance of an object.

Source Error: 


Line 46: 
Line 47:             _taskprogress = "Asynchronous task completed."
Line 48:             _dlgt.EndInvoke(ar)
Line 49: 
Line 50:         End Sub


Source File: clsFormAsync.vb    Line: 48 

Stack Trace: 


[NullReferenceException: Object reference not set to an instance of an object.]
   Samples.AspNet.VB.Controls.MyAsyncTask.OnEnd(IAsyncResult ar) in clsFormAsync.vb:48
   System.Web.UI.PageAsyncTask.CompleteTask(Boolean timedOut, Boolean syncTimeoutCaller) +365

[HttpException (0x80004005): Exception of type 'System.Web.HttpException' was thrown.]
   System.Web.UI.Page.ExecuteRegisteredAsyncTasks() +11440805
ViewProtocols.btnRefreshForm_Click(Object sender, EventArgs e) in ViewProtocols.aspx.vb:98
System.EventHandler.Invoke(Object sender, EventArgs e) +0
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +154
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3707

我真的不知道如何摆脱这个错误,欢迎提供帮助。

0 个答案:

没有答案