我的程序在本机运行正常,但发布到服务器时,登陆画面正常没,但需要主页面时候提示: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.]
   DataAccess.MerSrv.DataAccess.MerSrvClass..ctor() +53
   OmsManager.OmsManager.GetDsFromDb(String SqlSql) +42
   WebNotify.NotifyDetail.Page_Load(Object sender, EventArgs e) +105
   System.Web.UI.Control.OnLoad(EventArgs e) +67
   System.Web.UI.Control.LoadRecursive() +35
   System.Web.UI.Page.ProcessRequestMain() +731 我已经是Release发布了,不只这是为什么?

解决方案 »

  1.   

    Stack Trace: 
    [NullReferenceException: Object reference not set to an instance of an object.]
       DataAccess.MerSrv.DataAccess.MerSrvClass..ctor() +53
       OmsManager.OmsManager.GetDsFromDb(String SqlSql) +42
       WebNotify.NotifyDetail.Page_Load(Object sender, EventArgs e) +105
       System.Web.UI.Control.OnLoad(EventArgs e) +67
       System.Web.UI.Control.LoadRecursive() +35
       System.Web.UI.Page.ProcessRequestMain() +731
    根据你得堆栈跟踪,你得错误发生在NotifyDetail.Page_Load事件里面,你在这个事件里面存在着可能为null,也可能非null得对象,比如Session,Cache或者其他得对象!OmsManager.GetDsFromDb是你自己得代码麽?如果是就发生在那个里面,最上面得是发生错误得最终位置,是关于数据访问得,可以贴出你这些地方得代码,大家帮忙给看下就知道了!