“/PoliceWeb”应用程序中的服务器错误。
--------------------------------------------------------------------------------未将对象引用设置到对象的实例。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.NullReferenceException: 未将对象引用设置到对象的实例。源错误: 执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。 堆栈跟踪:
[NullReferenceException: 未将对象引用设置到对象的实例。]
ASP.global_asax.Session_Start(Object sender, EventArgs e) +139
System.Web.SessionState.SessionStateModule.RaiseOnStart(EventArgs e) +2221711
System.Web.SessionState.SessionStateModule.CompleteAcquireState() +159
System.Web.SessionState.SessionStateModule.BeginAcquireState(Object source, EventArgs e, AsyncCallback cb, Object extraData) +518
System.Web.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +90
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +161
这是错误报告、在发布前。用VS2005运行没有错误。 发布后就出现这个错误
--------------------------------------------------------------------------------未将对象引用设置到对象的实例。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.NullReferenceException: 未将对象引用设置到对象的实例。源错误: 执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。 堆栈跟踪:
[NullReferenceException: 未将对象引用设置到对象的实例。]
ASP.global_asax.Session_Start(Object sender, EventArgs e) +139
System.Web.SessionState.SessionStateModule.RaiseOnStart(EventArgs e) +2221711
System.Web.SessionState.SessionStateModule.CompleteAcquireState() +159
System.Web.SessionState.SessionStateModule.BeginAcquireState(Object source, EventArgs e, AsyncCallback cb, Object extraData) +518
System.Web.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +90
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +161
这是错误报告、在发布前。用VS2005运行没有错误。 发布后就出现这个错误
if(Session["xx"]!= null)
{
//使用Session
}没有代码,看信息像是Session问题
2. 未将对象引用设置到对象的实例 这个错误很常见 对象或session为空就报错
3. 防止对象为空错误就应该 做判断if(对象!=null){ //其他代码 }
孟子速度真快 但是不是要的解决方案楼主 查看你的网站的web.config 的Session 配置 是什么,如果配置的是将Session 存放在asp.net的状态服务进程中 则要启动该服务.
如果是存在数据库则要注意看登陆信息有没错.