Object reference not set to an instance of an object解决办法
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.]
ZFSoft.BusinessEntity.Getstring(String columnName) +48
之前是好好的,突然打开网页就出现这个问题了,同样的代码没问题在其他服务器服务器上没有这个问题,请问下可能是啥原因引起的?
------解决思路----------------------
别说同样的代码在其他服务器上没有这个问题,这算什么逻辑?
自己想想,其他服务器和出错服务器配置、环境都一样吗?
------解决思路----------------------
未将对象应用设置到对象实例。有可能数据库表中内容为空时,你没有处理之类的异常。这种可能太多了,要你自己仔细找才知道
------解决思路----------------------
代码健壮度不够,缺乏必须的判断,你仔细看下getstring方法
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.]
ZFSoft.BusinessEntity.Getstring(String columnName) +48
之前是好好的,突然打开网页就出现这个问题了,同样的代码没问题在其他服务器服务器上没有这个问题,请问下可能是啥原因引起的?
------解决思路----------------------
别说同样的代码在其他服务器上没有这个问题,这算什么逻辑?
自己想想,其他服务器和出错服务器配置、环境都一样吗?
------解决思路----------------------
未将对象应用设置到对象实例。有可能数据库表中内容为空时,你没有处理之类的异常。这种可能太多了,要你自己仔细找才知道
------解决思路----------------------
代码健壮度不够,缺乏必须的判断,你仔细看下getstring方法