0

IIS 7にASP.NETアプリケーションを展開しているときに、エラーが発生します。

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. 

例外の詳細:System.IndexOutOfRangeException:テーブル0が見つかりません。

 Source Error: 
    Line 46:             dsDesignation= GetChartData("select * from LHSDesignation");
    Line 47: 
    Line 48:             if (dsDesignation != null && dsDesignation.Tables[0].Rows.Count > 0)
    Line 49:             {
    Line 50:                 foreach (DataRow dr in dsDesignation.Tables[0].Rows)


    Source File: D:\Raji\LHS\LHS\Chart.aspx.cs    Line: 48 

Stack Trace: 

[IndexOutOfRangeException: Cannot find table 0.]
   System.Data.DataTableCollection.get_Item(Int32 index) +95
   LHS.Chart.Page_Load(Object sender, EventArgs e) in D:\Raji\LHS\LHS\Chart.aspx.cs:48
   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

また、ページ読み込みのコードは次のとおりです。

protected void Page_Load(object sender, EventArgs e)
        {
            string tmpDesignation = string.Empty;
            conString =Convert.ToString(ConfigurationManager.AppSettings["conString"]);
            strDesignation = Convert.ToString(ConfigurationManager.AppSettings["Designation"]);
            conection = new SqlConnection(conString);

            if (HttpContext.Current.Session["UserLogin"] != null)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "$.prompt('Please login to Update Score')", true);
            }

            dsDesignation= GetChartData("select * from LHSDesignation");

            if (dsDesignation != null && dsDesignation.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow dr in dsDesignation.Tables[0].Rows)
                {
                    dnDesignatin.Add(Convert.ToString(dr["DesignationName"]), Convert.ToString(dr["TargetScore"]));
                }
            }            

このエラーの解決に協力してくださいIIS7で実行するには何をする必要がありますか?

4

2 に答える 2

0

これで、アプリケーションを正常に実行できるようになりました。私は次のことをしました:

  1. SQLSERVERに新しいログイン「IISAPPPOOL\LHS」を作成しました

  2. Cで「TempImageFiles」という名前のフォルダを作成しました:その後、これは正常に実行されました

于 2013-02-05T07:13:46.863 に答える
0

アプリケーションプールで32ビットアプリケーションを有効にすると、問題が解決しました。

于 2021-11-17T10:01:48.457 に答える