20100507 学习记录: Server Error in '/' Application. Object reference not set to an instance of an object
2010-05-07 15:24
966 查看
今天本计划中午把.net重写的页面部署到production的,可是程序不给面子,总是报这个要命的错误。
这个错误偶看着极其眼熟,已经照面好几次了,可是记得的以前的解决办法全部不好用了... orz
折腾来折腾去,在网上猛查一顿,这个错误的发生率还是很高滴说~ 不过大家描述情况千奇百怪,什么说法都有.. 查了俩小时,有效办法一个都没,搞的偶死的心都有了 (┬_┬)
因为偶滴代码已经测过多次,而且本地和测试环境都木有问题,所以最后还是觉得连接数据库的部分最为可疑,于是试着把production的web.config扔到qc上测了一下,然后查看了一下log....... 结果......... (┬_┬)(┬_┬)(┬_┬)
居然是数据库的问题!!!!!!
我们这次更新了几个表,添加了几个新列,production没有更新程序找不到列自然报错了。。。(┬_┬)
正在这个时候,production一直遍寻不着的log文件也终于姗姗现身,再次证实了我的判断——nnd,你早死哪去了!!!
于是趁着还有记忆,总结一下今天查到的关于这个错误的可能的解决办法留做将来参考:
1.顾名思义,空对象引用嘛~ 所以还在调试中的时候遇到这个错误第一个先找报错行到底是哪里的对象没有处理好,引用时是null的
2.如果本地调通了,确定程序木有问题了,却在部署到其他环境时出了问题则要考虑——
a)iis中该程序对应的属性中,asp.net的版本一定要一致!像我们系统就是原来是1.x的asp程序,现在需要升级到2.x
印象中,一般这个改过来了,基本程序就没问题可以跑通了
保险起见,可以做一个很简单的.net页面放到同样的位置测试,比如显示今天日期什么的。如果该页面能正常显示,那么说明起码不是版本问题,可以往下检查了。不然就要好好检查一下framework之类的了。
b)如同偶今天遇到的情况,虽然程序代码都是正确无误的,但是要想想数据库等相关的东东是否两个环境都是一致的。
有时候开发和部署时间拖的比较长,可能这些不大的小变更就会记不住了,所以在做变更的时候一定要作好记录以备将来查阅。免得 像我似的,虽然貌似记得有这回事,但是部署的时候完全忘了个干净。。。。orz
c)看到有的人是因为机器上装了卡巴斯基导致的,好像是卡巴的某个版本会影响程序。
建议关掉卡巴或者其他防火墙之类的试试
d)iis和文件目录的权限设置,看看目录有没有写入权限,网页目录有没有执行脚本的权限
e)检查数据库的连接用户名密码。程序是否访问数据库,与数据库链接是否有问题
f)对了,记得要把web.config设置成debug状态的
额... 暂时就记得这么多了,其实看一下基本都是粗心马虎的问题 Orz|||
======================================================================
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Stack Trace:
这个错误偶看着极其眼熟,已经照面好几次了,可是记得的以前的解决办法全部不好用了... orz
折腾来折腾去,在网上猛查一顿,这个错误的发生率还是很高滴说~ 不过大家描述情况千奇百怪,什么说法都有.. 查了俩小时,有效办法一个都没,搞的偶死的心都有了 (┬_┬)
因为偶滴代码已经测过多次,而且本地和测试环境都木有问题,所以最后还是觉得连接数据库的部分最为可疑,于是试着把production的web.config扔到qc上测了一下,然后查看了一下log....... 结果......... (┬_┬)(┬_┬)(┬_┬)
居然是数据库的问题!!!!!!
我们这次更新了几个表,添加了几个新列,production没有更新程序找不到列自然报错了。。。(┬_┬)
正在这个时候,production一直遍寻不着的log文件也终于姗姗现身,再次证实了我的判断——nnd,你早死哪去了!!!
于是趁着还有记忆,总结一下今天查到的关于这个错误的可能的解决办法留做将来参考:
1.顾名思义,空对象引用嘛~ 所以还在调试中的时候遇到这个错误第一个先找报错行到底是哪里的对象没有处理好,引用时是null的
2.如果本地调通了,确定程序木有问题了,却在部署到其他环境时出了问题则要考虑——
a)iis中该程序对应的属性中,asp.net的版本一定要一致!像我们系统就是原来是1.x的asp程序,现在需要升级到2.x
印象中,一般这个改过来了,基本程序就没问题可以跑通了
保险起见,可以做一个很简单的.net页面放到同样的位置测试,比如显示今天日期什么的。如果该页面能正常显示,那么说明起码不是版本问题,可以往下检查了。不然就要好好检查一下framework之类的了。
b)如同偶今天遇到的情况,虽然程序代码都是正确无误的,但是要想想数据库等相关的东东是否两个环境都是一致的。
有时候开发和部署时间拖的比较长,可能这些不大的小变更就会记不住了,所以在做变更的时候一定要作好记录以备将来查阅。免得 像我似的,虽然貌似记得有这回事,但是部署的时候完全忘了个干净。。。。orz
c)看到有的人是因为机器上装了卡巴斯基导致的,好像是卡巴的某个版本会影响程序。
建议关掉卡巴或者其他防火墙之类的试试
d)iis和文件目录的权限设置,看看目录有没有写入权限,网页目录有没有执行脚本的权限
e)检查数据库的连接用户名密码。程序是否访问数据库,与数据库链接是否有问题
f)对了,记得要把web.config设置成debug状态的
Web.config的配置文件- <configuration> <system.web> <compilation debug="true"/> <customErrors mode="Off"/> .........其他可能产生的情况收集中.....
额... 暂时就记得这么多了,其实看一下基本都是粗心马虎的问题 Orz|||
======================================================================
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. |
[NullReferenceException: Object reference not set to an instance of an object.] _ReportHeldOrder.Page_Load(Object sender, EventArgs e) +148 System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35 System.Web.UI.Control.OnLoad(EventArgs e) +99 System.Web.UI.Control.LoadRecursive() +50 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627 |
相关文章推荐
- Server was unable to process request. ---> Object reference not set to an instance of an object解决
- Error with Stsadm Command-Object reference not set to an instance of an object
- NET:Error Creating Control -"Object Reference Not Set To An Instance Of Object"
- Submit Reporting Table Error : Object reference not set to an instance of an object.
- VB.NET Error Object reference not set to an instance of an object
- VS2010 出现错误提示“Error Creating Control - Object reference not set to an instance of an objec” 的解决方法
- server2008 IIS7.5 Object reference not set to an instance of an object. (未将对象引用到实例)
- object reference not set to an instance of an object" - Not "initialized" through WCF?
- WebAdaptor Object reference not set to an instance of an object.
- vs数据库访问出现Object reference not set to an instance of an object. 错误解决办法
- vs2015 新建项目时提示Object reference not set to an instance of an object该怎么解决呢
- Sharepoint timer job:Object reference not set to an instance of an object
- TFS 客户端错误"Object reference not set to an instance of an object."
- NullReferenceException: Object reference not set to an instance of an object
- 当在一个siliverlight 2.0工程中 添加webservice时 遇到错误:'Object reference not set to an instance of an object' 解决办法
- SQLite应用程序启动报错:Object reference not set to an instance of an object.
- [Bug]Object reference not set to an instance of an object.
- This qt version uses an unsupported makefile generator object reference not set to an instance of an
- Object reference not set to an instance of an object.请教, 这是涉及那方面的错误啊?谢谢!
- Visual Studio 2015打开ASP.NET MVC的View提示"Object reference not set to an instance of an object"错误的解决方案