现在发现,偶儿我的网站只要某一个动态页面出现错误,其它动态页面都会出现错误!但过一小会儿,刷新一下页面,动态页面又都好了,常会出现这样的问题!
如,我们网站有一个在线订购平台,登陆后,所有的页面没有什么问题,都可以,一会儿,操纵着操纵着,页面突然卡住了,等页面加载完后,会显示如下信息:
Server Error in '/' Application.
----------------------------------------------------------------------------
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: 
An unhandled exception was generated during the execution of the current web 
request. Information regarding the origin and location of the exception can 
be identified using the exception stack trace below.  Stack Trace: 
[NullReferenceException: Object reference not set to an instance of an object.]
   main.BindNews() +110
   main.Page_Load(Object sender, EventArgs e) +5
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +33
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   System.Web.UI.Control.LoadRecursive() +47
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436----------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET 
Version:2.0.50727.1433 紧接着回到网站首页,也打不开,也会出现这样的错误!
Stack Trace 信息如下:

[NullReferenceException: Object reference not set to an instance of an object.]
   orderOnline_Model_top_menu.Page_Load(Object sender, EventArgs e) +126
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +33
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   System.Web.UI.Control.LoadRecursive() +47
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436真不知道哪里出现问题了!从Stack Trace也看不出个什么问题!在本机上运行真的没有什么问题呀!为啥在服务器有会有呢?
原本以为是session过期,但现在我都在页面加载之前判断了session是否为NULL,但还是出现这种问题!
各们大虾们,给点建议吧!这种问题只是偶儿会出现!

解决方案 »

  1.   

    清一下C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files 的文件!
      

  2.   

    compilation debug="true" 
    或上服务器  运行,就能报出错误在哪里
      

  3.   

    http://www.cnblogs.com/thinhils/archive/2008/07/09/1238726.html
      

  4.   

    会不会是连接池用完了  检查数据库连接操作后有没及时的释放连接.. 特别是sqldatereader 用的地方
     
      

  5.   

    没法调呀!因为在本机上运行都是正常的.没有什么问题的...我后台程序都是以dataset读了出来的,然后再来绑定!
      

  6.   

    其实已经提示你的代码哪里出现错误了。
    Stack Trace: 
    [NullReferenceException: Object reference not set to an instance of an object.] 
      main.BindNews() +110 
      main.Page_Load(Object sender, EventArgs e) +5 
      System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15 
      System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +33 
      System.Web.UI.Control.OnLoad(EventArgs e) +99 
      System.Web.UI.Control.LoadRecursive() +47 
      System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436 那就应该着重看一下这些提示,看看这里什么情况下会出现空引用。