在本地运行正常,但发布后在运行出错
是不是因为MDBdatabase.cs问题?
-------------------------------------------------------------------------------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: 
[No relevant source lines]
 Source File: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\gxapp\15fc6d18\650af0f9\App_Web_7xpm36pj.0.cs    Line: 0 Stack Trace: 
[NullReferenceException: Object reference not set to an instance of an object.]
   MDBdatabase..cctor() +50[TypeInitializationException: The type initializer for 'MDBdatabase' threw an exception.]
   MDBdatabase..ctor() +0
   glapp.algorithm..ctor() +44
   ASP.gl_algorithm_aspx..ctor() in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\gxapp\15fc6d18\650af0f9\App_Web_7xpm36pj.0.cs:0
   __ASP.FastObjectFactory_app_web_7xpm36pj.Create_ASP_gl_algorithm_aspx() in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\gxapp\15fc6d18\650af0f9\App_Web_7xpm36pj.1.cs:0
   System.Web.Compilation.BuildResultCompiledType.CreateInstance() +32
   System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp, Boolean noAssert) +119
   System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +33
   System.Web.UI.PageHandlerFactory.System.Web.IHttpHandlerFactory2.GetHandler(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +40
   System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) +160
   System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +93
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155 
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053 

解决方案 »

  1.   

    System.NullReferenceException这个异常我每天在CSDN都会看到好几遍
      

  2.   

    断点跟一下,是有地方你没实例化(new),空引用,导致找不到对象。
      

  3.   

    NullReferenceException 
    这个是空值异常
      

  4.   

    未将对象引用到对象的实例.也就是没有实例化一个对象。
    当声明了变量,但是没有赋值,仍然为null.用的时候就会报错.
      

  5.   

    非常感谢楼上各位,特别是2、4楼建议不错,明天上班立马测试
    我是刚接触.net两个月,有些错误提示还没什么会看,如:
    TypeInitializationException: The type initializer for 'MDBdatabase' threw an exception.]
       MDBdatabase..ctor() +0
       glapp.algorithm..ctor() +44
     是什么意思?
    我发布的调用公共类MDBdatabase的运行正常,感觉是不是mdbdatabase调用是不是有问题?