【发布时间】:2012-07-02 16:31:27
【问题描述】:
我一次又一次遇到以下问题,我不知道如何解决它..
我经常遇到以下错误,我不得不restart the IIS 或republish 临时解决问题:
Error Message:Request timed out.
Error Message:ERROR [08S01] [Informix .NET provider]Communication link failure.
Error Message:Thread was being aborted.
我试着做:
<httpRuntime executionTimeout="600" />
但还是同样的问题!!
Stack Trace:
at System.Web.HttpContext.InvokeCancellableCallback(WaitCallback callback, Object state)
at System.Web.UI.Page.AsyncPageBeginProcessRequest(HttpContext context, AsyncCallback callback, Object extraData)
at ASP.appmaster_aspx.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object data)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
我的页面加载:
protected void Page_Load(object sender, EventArgs e)
{
if (Session["emp_num"] != null && !string.IsNullOrEmpty(Session["emp_num"].ToString()))
{
try
{
string user_setting = Personalization_DAL.CheckWidgetSettings(int.Parse(Session["emp_num"].ToString()));
if (!string.IsNullOrEmpty(user_setting))
{
user_flag = int.Parse(user_setting);
}
GetLinkedApp = DB_Connection_s.DB_Connection.GetLinkedAppUser(int.Parse(Session["emp_num"].ToString()));
if (!Page.IsPostBack)
{
//Profile
GetProfile();
if (Session["emp_app"] != null && !string.IsNullOrEmpty(Session["emp_app"].ToString()))
{
BindAvailableSystems(Session["emp_app"].ToString());
}
BindMainSystems();
if (GetLinkedApp > 0)
{
rlv_available_sys.Visible = true;
h5_app.Visible = true;
lbtn_addApp.Visible = false;
h4_app.Visible = false;
intro.Visible = true;
}
else
{
rlv_available_sys.Visible = false;
h5_app.Visible = false;
lbtn_addApp.Visible = true;
h4_app.Visible = true;
intro.Visible = false;
}
//Applications
if (rlv_available_sys.Visible == true)
{
Session["emp_app"] = GetLinkedApp;
BindAvailableSystems(Session["emp_app"].ToString());
if (user_flag > 0)
{
Get_UserApplicationSystems(1, 1, GetLinkedApp.ToString());
}
else
{
Get_UserApplicationSystems(user_flag, 1, GetLinkedApp.ToString());
}
}
//services
Get_MainSystems(user_flag);
if (GetLinkedApp > 0)
{
GetServiceInformation();
}
string[] statistics = TrackUser();
base.TraceActivity("Enter the portal", "https://" + Request.Url.Authority + "/AppMaster.aspx", statistics[0], statistics[1], statistics[2]);
}
TraceSystemsMode();
}
catch (Exception ee)
{
string message = ee.Message;
}
}
else
{
Response.Redirect("LoginPage.aspx", false);
}
}
我的通用处理程序:
public void ProcessRequest(HttpContext context)
{
try
{
using(Stream photo_stream = Photo_DAL.RetrievePhoto(int.Parse(context.Session["emp_num"].ToString())))
{
byte[] photo_bytes = Photo_DAL.StreamToByteArray(photo_stream);
if (photo_bytes == null)
{
photo_bytes = File.ReadAllBytes(Path.Combine(context.Server.MapPath("~/images/PortalImages/"), "user.png"));
}
//context.Response.ContentType = "image/png";
context.Response.BinaryWrite(photo_bytes);
}
}
catch (Exception ee)
{
}
}
【问题讨论】:
-
请告诉你对请求做了什么操作
-
只需连接到 DB 以带来数据并插入数据并通过通用处理程序获取图像..
-
好的,现在将您的代码分成 3 个部分 1) 获取数据 2) 插入数据和 3) 图像处理程序,并通过一次禁用一个来运行以找出其中哪些需要时间。
-
如果我知道某个特定部分确实比其他部分花费了很长时间,我该怎么办?假设图像处理程序..
-
如果你确定它是图像处理程序,那么你应该增加你的执行超时并再试一次,如果它仍然不起作用,那么重新处理你的图像处理逻辑就没有其他出路了。这是您的帮助链接codebetter.com/petervanooijen/2006/06/15/…
标签: asp.net performance .net-3.5 iis-7.5 informix