开发环境 vs2008+Sql Server2005
数据操作采用 Linq
在调试的时候没有任何的问题,但是当发布到IIS(windows server2003)时,一开始操作没有问题,但是操作上5分钟左右就会出现问题 把IIS给当掉了。只有重新启动下IIS才能继续用?请这该怎么办?
下面是我的操作代码(其余文件类似写法):
Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
///操作报告数据类
namespace PGGSOA.DAL
{
public class ProjectReport
{
#region "根据项目编码与报告类型返回报告"
/// <summary>
/// 根据项目编码与报告类型返回报告
/// </summary>
/// <param name="ProjectID">项目编码</param>
/// <param name="TypeID">报告类型</param>
/// <returns></returns>
public static PGGSOA.COMMON.Components.ProjectReport ProjectReportDisp(int ProjectID, int TypeID)
{
MyDataClassesDataContext DataContext = new MyDataClassesDataContext();
var q = (from p in DataContext.project_Report
where p.ProjectID == ProjectID && p.TypeID == TypeID
select p).FirstOrDefault();
PGGSOA.COMMON.Components.ProjectReport pReport = new PGGSOA.COMMON.Components.ProjectReport();
if (q != null)
{
pReport.ReportID = q.ReportID;
pReport.ProjectID = (int)q.ProjectID;
pReport.TypeID = (int)q.TypeID;
pReport.ReportContent = q.ReportContent;
}
return pReport;
}
#endregion
#region "判断相应的报告类型是否存在"
/// <summary>
/// 判断相应的报告类型是否存在
/// </summary>
/// <param name="ProjectID">项目编码</param>
/// <param name="TypeID">报告类型</param>
/// <returns></returns>
public static bool ProjectReportCheck(int ProjectID, int TypeID)
{
bool rbool = false;
MyDataClassesDataContext DataContext = new MyDataClassesDataContext();
var q = (from p in DataContext.project_Report
where p.ProjectID == ProjectID && p.TypeID == TypeID
select p).FirstOrDefault();
if (q != null)
{
if (q.ReportContent != null && q.ReportContent != "")
{
rbool = true;
}
}
return rbool;
}
#endregion
#region "项目报告操作类"
/// <summary>
/// 项目报告操作类
/// </summary>
/// <param name="PR">项目报告实体类</param>
/// <returns></returns>
public static bool ProjectReportExecute(PGGSOA.COMMON.Components.ProjectReport Report)
{
bool rbool = false;
MyDataClassesDataContext DataContext = new MyDataClassesDataContext();
if (Report.DB_Option_Action_ == "Insert")
{
var q = new project_Report
{
ProjectID = (int)Report.ProjectID,
TypeID = (int)Report.TypeID,
ReportContent = Report.ReportContent
};
DataContext.project_Report.InsertOnSubmit(q);
DataContext.SubmitChanges();
rbool = true;
}
else if (Report.DB_Option_Action_ == "Update")
{
var q = (from p in DataContext.project_Report
where p.ProjectID == Report.ProjectID && p.TypeID == Report.TypeID
select p).FirstOrDefault();
if (q != null)
{
q.ReportContent = Report.ReportContent;
DataContext.SubmitChanges();
rbool = true;
}
}
else if (Report.DB_Option_Action_ == "Delete")
{
var q = (from p in DataContext.project_Report
where p.ProjectID == Report.ProjectID && p.TypeID == Report.TypeID
select p).FirstOrDefault();
if (q != null)
{
DataContext.project_Report.DeleteOnSubmit(q);
DataContext.SubmitChanges();
rbool = true;
}
}
else
{
throw new Exception("未定义的DB_Option_Action_值");
}
return rbool;
}
#endregion
}
}