我在移置的过程中出现了,到2003服务器上可以使用但对已经配置完成了2000上去出现了问题,出现如下问题!“/”应用程序中的服务器错误。
--------------------------------------------------------------------------------未将对象引用设置到对象的实例。 
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.NullReferenceException: 未将对象引用设置到对象的实例。源错误: 执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。  堆栈跟踪: 
[NullReferenceException: 未将对象引用设置到对象的实例。]
   _6zsite.Global.Session_Start(Object sender, EventArgs e) in d:\site\6zsite\global.asax.cs:42
   System.Web.SessionState.SessionStateModule.RaiseOnStart(EventArgs e) +132
   System.Web.SessionState.SessionStateModule.CompleteAcquireState() +512
   System.Web.SessionState.SessionStateModule.BeginAcquireState(Object source, EventArgs e, AsyncCallback cb, Object extraData) +697
   System.Web.AsyncEventExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute() +66
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +173
下面是我的global.asax.cs文件
using System;
using System.Collections;
using System.ComponentModel;
using System.Web;
using System.Web.SessionState;
using System.Data.SqlClient;namespace _6zsite 
{
/// <summary>
/// Global 的摘要说明。
/// </summary>
public class Global : System.Web.HttpApplication
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null; public Global()
{
InitializeComponent();
}

protected void Application_Start(Object sender, EventArgs e)
{
           SqlConnection con=DB.createConnection();
   con.Open();
SqlCommand cmd=new SqlCommand("select * from sitecount",con);
int count;
count=Convert.ToInt32(cmd.ExecuteScalar());
Application["totol"]=count;
Application["online"]=0;
            con.Close();

}
 
protected void Session_Start(Object sender, EventArgs e)
{
//            为防止并发错误
Application.Lock();
            Application["totol"]=(int)Application["totol"]+1;
            Application["online"]=(int)Application["online"]+1;
Application.UnLock();
} protected void Application_BeginRequest(Object sender, EventArgs e)
{ } protected void Application_EndRequest(Object sender, EventArgs e)
{ } protected void Application_AuthenticateRequest(Object sender, EventArgs e)
{ } protected void Application_Error(Object sender, EventArgs e)
{ } protected void Session_End(Object sender, EventArgs e)
{
Application.Lock();
Application["online"]=(int)Application["online"]-1;
Application.UnLock();
} protected void Application_End(Object sender, EventArgs e)
{
SqlConnection con=DB.createConnection();
con.Open();
SqlCommand cmd=new SqlCommand("update sitecount set num="+Application["totol"].ToString(),con);
cmd.ExecuteNonQuery();
con.Close();

}

#region Web 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{    
this.components = new System.ComponentModel.Container();
}
#endregion
}
}
下面是我的数据连接类
using System;
using System.Data.SqlClient;namespace _6zsite
{
/// <summary>
/// DB 的摘要说明。
/// </summary>
public class DB
{
public DB()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
public static SqlConnection createConnection()
{
System.Data.SqlClient.SqlConnection con= new SqlConnection("server=(local);uid=sa;pwd=316000;database=eduSite");
return con;
}
}

}为什么会出错,
我自己分析可能是数据库连接上的错误,我可以通过什么方法可以测试数据之间连接的成功,以前我不代码后置,("server=(local);uid=sa;pwd=316000;database=eduSite");通过这种方法可以用