1

我正在开发一个需要执行异步任务的应用程序。我使用了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

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

4

0 回答 0