我在 Asp.Net 3.5 中开发了一个应用程序。在此,我使用了 4 层架构。
服务器详细信息
应用程序托管在带有 IIS 7 的 Windows Server 2008 64 位操作系统上。服务器具有 32GB 的 RAM 和 200GB 的硬盘驱动器。
两者都发布托管在同一台服务器上的应用程序和数据库。
问题
我有一份审核表,我正在尝试提交对员工的审核。
当单用户登录到 Web 服务器上的应用程序时,应用程序工作正常。用户可以提交他们的评论。但是一旦它增加到一个以上,它就会产生问题。假设有多个用户一次单击提交按钮提交评论,那么只有一个员工记录存储在数据库中,其余所有用户数据都没有存储,但所有用户都收到一条消息“提交成功”。
我还检查了事件日志中的错误,并收到如下消息。
事件代码:3005 事件消息:发生未处理的异常。事件时间:2013 年 3 月 6 日上午 11:53:37 事件时间 (UTC):2013 年 3 月 6 日上午 6:23:37 事件 ID:e417857a86074b16bbf05bce818a5b0d 事件序列:11 事件发生:1 事件详细代码:0
应用程序信息:应用程序域:/LM/W3SVC/1/ROOT/spmstest-2-130070176529122850 信任级别:完整应用程序虚拟路径:/spmstest 应用程序路径:C:\hrpmsapp\PMSPublished Test\机器名称:INDW00029
进程信息:进程ID:9320 进程名:w3wp.exe 账户名:IIS APPPOOL\DefaultAppPool
异常信息:异常类型:NullReferenceException 异常消息:对象引用未设置为对象的实例。
请求信息: 请求 URL: 请求路径: 用户主机地址: 用户: 已通过身份验证: False 身份验证类型: 线程帐户名: IIS APPPOOL\DefaultAppPool
线程信息:线程 ID:10 线程帐户名称:IIS APPPOOL\DefaultAppPool 正在模拟:False 堆栈跟踪:在 ASP.global_asax.Session_End(Object sender, EventArgs e)
自定义活动详情:
请在下面找到示例代码。
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using PMS.BO;
using PMS.BAL;
using System.Data.OleDb;
public partial class Reviews_DevelopmentReview : System.Web.UI.Page
{
ClsUtility cUtil = new ClsUtility();
ClsDevRevBAL DevRevBAL = new ClsDevRevBAL();
ClsDevRevBO DevRevBO = new ClsDevRevBO();
ClsObjectiveBAL ObjBAL = new ClsObjectiveBAL();
ClsMailSetBO MailSetBO = new ClsMailSetBO();
ClsMailSetBAL MailSetBAL = new ClsMailSetBAL();
static DataSet dsDevRevGridHead;
static DataTable dtDataForMail;
static int DevRevCode = 0;
int EmpRating = 0; int MgrRating = 0;
int result;
static int StatusCode;
static bool isFiveRatingApplicable = false;
static string companyId = string.Empty;
static string JobRoleId = string.Empty;
static string EmpCode = string.Empty;
static int loginEmpCode;
static string LoginType = string.Empty;
protected void Page_Load(object sender, EventArgs e)
{
if (Session["UserID"] == null)
{
Response.Redirect("../Default.aspx?Session=expired");
}
LoginAuthentication loginAuth = new LoginAuthentication();
LoginVariables loginVar = loginAuth.getSession();
if (!Page.IsPostBack)
{
companyId = loginVar.CompanyId;
if (Request.QueryString.Count > 0)
{
if (Request.QueryString["Id"].ToString() != null)
{
dtDataForMail = cUtil.GetEmpDetail(int.Parse(Request.QueryString["Id"].ToString()));
EmpCode = Request.QueryString["Id"].ToString();
loginEmpCode = int.Parse(loginVar.EmployeeID);
LoginType = "Manager";
}
isFiveRatingApplicable = cUtil.GetIsFiveRatingApplicable(EmpCode);
StatusCode = DevRevBAL.GetStatusCode(EmpCode);
switch (StatusCode)
{
case 2:
DisableControls();
btnSubmitLater.Visible = false;
btnSubmit.Visible = false;
break;
case 3:
DisableControls();
btnSubmitLater.Visible = false;
btnSubmit.Visible = false;
btnFinalize.Visible = true;
break;
case 4:
DisableControls();
btnSubmitLater.Visible = false;
btnSubmit.Visible = false;
btnFinalize.Enabled = false;
if (companyId == "0")
{
btnFinalize.Visible = true;
btnFinalize.Enabled = true;
txtHrComment.Enabled = true;
}
break;
case 5:
DisableControls();
btnSubmitLater.Visible = false;
btnSubmit.Visible = false;
btnFinalize.Enabled = false;
break;
default:
break;
}
}
else
{
EmpCode = loginVar.EmployeeID;
loginEmpCode = int.Parse(loginVar.EmployeeID);
LoginType = "Employee";
isFiveRatingApplicable = cUtil.GetIsFiveRatingApplicable(EmpCode);
StatusCode = DevRevBAL.GetStatusCode(EmpCode);
switch (StatusCode)
{
case 1:
btnSubmit.Visible = false;
btnSubmitLater.Visible = false;
btnFinalize.Visible = false;
txtEmpAreaForSkill.ReadOnly = true;
txtEmpAreaForDev.ReadOnly = true;
break;
case 2:
btnSubmit.Visible = false;
btnSubmitLater.Visible = false;
btnFinalize.Visible = true;
txtEmpAreaForSkill.ReadOnly = true;
txtEmpAreaForDev.ReadOnly = true;
txtEmployeeComment.ReadOnly = false;
break;
case 3:
btnSubmit.Visible = false;
btnSubmitLater.Visible = false;
btnFinalize.Enabled = false;
txtEmpAreaForSkill.ReadOnly = true;
txtEmpAreaForDev.ReadOnly = true;
txtEmployeeComment.ReadOnly = true;
break;
case 4:
DisableControls();
btnSubmitLater.Visible = false;
btnSubmit.Visible = false;
btnFinalize.Enabled = false;
break;
case 5:
DisableControls();
btnSubmitLater.Visible = false;
btnSubmit.Visible = false;
btnFinalize.Enabled = false;
break;
default:
break;
}
}
DataTable dtData = cUtil.GetEmpDetail(int.Parse(EmpCode));
txtEmployee.Text = dtData.Rows[0]["EmpName"].ToString();
txtBranch.Text = dtData.Rows[0]["Branch"].ToString();
txtDesignation.Text = dtData.Rows[0]["Designation"].ToString();
txtManager.Text = dtData.Rows[0]["Approver"].ToString();
JobRoleId = dtData.Rows[0]["JobRoleId"].ToString();
if (dtData.Rows[0]["Status"].ToString() != "True")
{
Menu1.Items.Add(new MenuItem { ImageUrl = "../Images/selectedtab1.png", Value = "0", Text = "" });
Menu1.Items.Add(new MenuItem { ImageUrl = "../Images/unselectedtab2.png", Value = "1", Text = "" });
Menu1.Items.Add(new MenuItem { ImageUrl = "../Images/unselectedtab4.png", Value = "3", Text = "" });
}
else
{
Menu1.Items.Add(new MenuItem { ImageUrl = "../Images/selectedtab1.png", Value = "0", Text = "" });
Menu1.Items.Add(new MenuItem { ImageUrl = "../Images/unselectedtab2.png", Value = "1", Text = "" });
Menu1.Items.Add(new MenuItem { ImageUrl = "../Images/unselectedtab3.png", Value = "2", Text = "" });
Menu1.Items.Add(new MenuItem { ImageUrl = "../Images/unselectedtab4.png", Value = "3", Text = "" });
}
Menu1.Items[0].Selected = true;
FillDevRevGridView();
FillTrainingListBox();
if (isFiveRatingApplicable == true)
{
// For Competencies Section
trRatingInstruction.Visible = false;
// For Development Actions Section
tblForFiveRating1.Visible = true;
// For Development Targets Section
lblDomesticMob.Visible = true;
rdDomMobStatus.Visible = true;
tblForFiveRating2.Visible = true;
// For Comments Section
lblHrComment.Visible = true;
txtHrComment.Visible = true;
}
}
EnableDisableControls();
}