各位前辈,网站发布到服务器上以后,浏览几分钟,过会就会出现下面的错误。
百度以后,有说权限问题的,但是这个是购买的空间,我设定不了。实在是想不出来,有的人说解决了但是没有说解决方法
所以请大家帮忙看看到底是什么愿意啊?谢谢!
Server Error in '/' Application.未指定的错误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.Exception: 未指定的错误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: 
[Exception: 未指定的错误]
   DAL.DbHelperOleDb.ExecuteReader(String strSQL) in D:\Programme\BiologyWeb\Tsingke\DAL\DbHelperOleDb.cs:264
   DAL.DALPromotion.GetShowPromotions(Int32 topNo) in D:\Programme\BiologyWeb\Tsingke\DAL\DALPromotion.cs:28
   BLL.BLLPromotion.GetShowPromotions(Int32 topNo) in D:\Programme\BiologyWeb\Tsingke\BLL\BLLPromotion.cs:24
   Tsingke.Web.product1.Page_Load(Object sender, EventArgs e) in D:\Programme\BiologyWeb\Tsingke\Tsingke\Web\product.aspx.cs:50
   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) +91
   System.Web.UI.Control.LoadRecursive() +74
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272

解决方案 »

  1.   

    ExecuteReader方法出错 可能是你用了DataReader之后没有释放 连接池达到上限了 仔细检查一下代码是否释放了DB连接
      

  2.   

            public static OleDbDataReader ExecuteReader(string SQLString, params OleDbParameter[] cmdParms)
            {
                OleDbConnection connection = new OleDbConnection(connectionString);
                OleDbCommand cmd = new OleDbCommand();
                try
                {
                    PrepareCommand(cmd, connection, null, SQLString, cmdParms);
                    OleDbDataReader myReader = cmd.ExecuteReader();
                    cmd.Parameters.Clear();
                    return myReader;
                }
                catch (System.Data.OleDb.OleDbException e)
                {
                    throw new Exception(e.Message);
                }
                finally
                {
                    cmd.Clone();
                    cmd.Dispose();
                    connection.Close();
                    connection.Dispose();
                }        }不知道这样写是否可以,帮忙看看,谢谢。
      

  3.   

     reader是返回出去了 但是你在finally里面又把连接关掉了~你叫接收reader的方法怎么读?
      

  4.   

    方法里面先把东西读到一个容器中 关闭数据库连接 然后返回这个容器 容器可以是List 也可以是DataTable
    或者直接就用DataAdapter来 返回dataset
      

  5.   

    额,,,我理解错了你的意思
    我在前台创建调用这个方法的时候用了using。应该是强制释放了吧?
      

  6.   


    public static SqlDataReader ExecuteReader(string connectionString, CommandType cmdType, string cmdText, params SqlParameter[] commandParameters) 
            {
                //创建一个SqlCommand对象
                SqlCommand cmd = new SqlCommand();
                //创建一个SqlConnection对象
                SqlConnection conn = new SqlConnection(connectionString);            //在这里我们用一个try/catch结构执行sql文本命令/存储过程,因为如果这个方法产生一个异常我们要关闭连接,因为没有读取器存在,
                //因此commandBehaviour.CloseConnection 就不会执行
                try {
                    //调用 PrepareCommand 方法,对 SqlCommand 对象设置参数
                    PrepareCommand(cmd, conn, null, cmdType, cmdText, commandParameters);
                    //调用 SqlCommand  的 ExecuteReader 方法
                    SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                    //清除参数
                    cmd.Parameters.Clear();
                    return reader;
                }
                catch {
                    //关闭连接,抛出异常
                    conn.Close();
                    throw;
                }
            }在catch块中关闭连接 而不是在finally中
      

  7.   

    Server Error in '/' Application.
    --------------------------------------------------------------------------------Unspecified error 
    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.Exception: Unspecified errorSource Error: 
    Line 276:            {
    Line 277:                connection.Close();
    Line 278:                throw new Exception(e.Message);
    Line 279:            }
    Line 280:        }
     Source File: D:\Programme\BiologyWeb\Tsingke\DAL\DbHelperOleDb.cs    Line: 278 Stack Trace: 
    [Exception: Unspecified error]
       DAL.DbHelperOleDb.ExecuteReader(String strSQL) in D:\Programme\BiologyWeb\Tsingke\DAL\DbHelperOleDb.cs:278
       DAL.DALPromotion.GetShowPromotions(Int32 topNo) in D:\Programme\BiologyWeb\Tsingke\DAL\DALPromotion.cs:28
       BLL.BLLPromotion.GetShowPromotions(Int32 topNo) in D:\Programme\BiologyWeb\Tsingke\BLL\BLLPromotion.cs:24
       Tsingke.index2.Page_Load(Object sender, EventArgs e) in D:\Programme\BiologyWeb\Tsingke\Tsingke\index.aspx.cs:17
       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) +91
       System.Web.UI.Control.LoadRecursive() +74
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207 我是用本地的IIS7发布的,报错是上面的信息,报错后多几分钟,再刷新就正常了,总是在反复。
      

  8.   

    throw new Exception(e.Message);=》throw e 不要将异常包装后再抛出 直接抛原始异常
      

  9.   

    原始异常跟上面是一致的,没什么变化。 Source Error: 
    Line 276:            {
    Line 277:                connection.Close();
    Line 278:                throw e;
    Line 279:            }
    Line 280:        }
     
      

  10.   

    如果你是在本地调试出现这个异常 就在VS里面看看具体的异常 如果还是在SERVER上面 先暂时把catch快拿掉 显示具体的异常类型
      

  11.   

    您看看这个帖子http://topic.csdn.net/u/20081229/10/AB65533D-62D2-461F-92E2-BFED3FD195F3.html
    跟我一样的症状。
      

  12.   

    现在重点是要知道你的exception里面有没有嵌套的异常 所以我叫你去掉catch块试一下 因为在server端你没法进去看这个exception的innerexception是什么
      

  13.   

    去掉了试了一下,没有抛出特殊的异常。            //try
               // {
                    connection.Open();
                    OleDbDataReader myReader = cmd.ExecuteReader();
                    return myReader;
    去掉以后,他报错的就是 connection.Open(); 然后其他的都一样了。
      

  14.   

    IDataReader默认是会自动关闭连接的,不需要你手动去connection.close();也可以显示的这样写
    Command.ExecuteReader(System.Data.CommandBehavior.CloseConnection); 枚举第一个为默认的System.Data.CommandBehavior.CloseConnection 的意思就是 while(Idatareader.Read())读取完之后自动关闭连接
      

  15.   

    好的,谢谢你。是不是Access不能同时并发访问啊?不行我就用SQL是不是就不会出现这样的问题?
      

  16.   

    ACCESS支持并发的 其实很多时候并没有多少并发访问 因为每次请求之后连接都被关掉了 所以事实上没有并发 只是因为计算机处理起来快 所以看上去就跟并发差不多 
    如果不把数据库连接关掉 那么用什么数据库都是白搭
      

  17.   


    这就说明你删除了自己写的坑爹的try...catch...之后,终于循着正确的方向去找异常了。怎么你还是纠结在什么“关闭”问题上呢?
      

  18.   

    可还是没找到问题原因啊,真是惭愧啊。既然打开报错,是SQL语句的问题?呵呵,我已经晕了。。
      

  19.   

    自己多想一些调试的方法吧,例如加log,加输出,先确定是哪里出现的问题.再者,你们内部也应该有一个虚拟的测试环境吧,虚拟的服务器,多用几台机器测试,好多问题自己在自己的机器上很难调试出来.
      

  20.   

    己多想一些调试的方法吧,例如加log,加输出,先确定是哪里出现的问题.再者,你们内部也应该有一个虚拟的测试环境吧,虚拟的服务器,多用几台机器测试,好多问题自己在自己的机器上很难调试出来.