的Application_BeginRequest不是在强调环境被解雇 [英] Application_BeginRequest not being fired in stressed environment

查看:98
本文介绍了的Application_BeginRequest不是在强调环境被解雇的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在履行我们的applciation测试sress时obesrving奇怪的问题。我们使用的Application_BeginRequest和Application_EndRequest登录web请求的开始和结束时,一起与线程id

We are obesrving strange problems when performing sress test of our applciation. We use Application_BeginRequest and Application_EndRequest to log the beginning and end of the web request, together, with the thread id.

然而,从我们的日志,我们看到,Application_Begin_REquest未烧制

However, from our logs, we see that Application_Begin_REquest is not being fired:

我们使用以下code做日志记录的global.asax.cs:

We use the following code to do the logging in global.asax.cs:

protected void Application_BeginRequest(object sender, EventArgs e)
{
  string url = "";
  if (HttpContext.Current != null)  // this should alway be true
    url = HttpContext.Current.Request.Url.ToString();

  Dbg.WriteLine(String.Format("Request: {0} {1}", HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"], url));

  // integration calls measurement
  HttpContext.Current.Items.Add("wcfElapsed", new TimeSpan());

}

protected void Application_EndRequest(Object sender, EventArgs e)
{
  string url = "";
  if (HttpContext.Current != null)  // this should alway be true
    url = HttpContext.Current.Request.Url.ToString();

  Dbg.WriteLine(String.Format("End request: {0} {1}", HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"], url));
}

这是我们的日志文件。网址是省略00013列是线程ID。

This is our log file. Urls are omitted The 00013 column is thread id.

  14.12.10 21:41:25.042 00013 00000            Request: 172.23.26.41 
  14.12.10 21:41:25.068 00013 00000            End request: 172.23.26.41 
  14.12.10 21:41:25.212 00013 00000            Request: 172.23.26.41 
  14.12.10 21:41:25.223 00013 00000            End request: 172.23.26.41 
  14.12.10 21:41:30.974 00013 00000            End request: 172.23.26.88 

您可以看到,在过去的两行两个结束请求,但没有(开始)请求最后的日志行。

You can see that there are two "End request" in the last two lines, but there is no (Begin) Request for the last log line.

我们的Dbg.WriteLine使用System.Diagnostics程序跟踪监听器数据输出继电器到文件。

Our Dbg.WriteLine uses System.Diagnostics trace listeners to ouput data to the file.

环境:Windows Server 2008 R2中,ASP.NET 3.5

Environment: Windows Server 2008 R2, ASP.NET 3.5

这只是performin压力测试时发生。 CPU利用率在60%左右,也有执行最高10 concurent请求。

This only happens when performin stress test. CPU utilization is around 60%, there are max 10 concurent requests executing.

任何想法,可能是什么问题?

Any ideas, what could be wrong?

更新:我已经发现了一些其他的也确实有类似的问题(在不同的配置althoug:的 http://forums.iis.net/t/1154954.aspx
马捷

UPDATE: I have found out that some other also did have similar problems (althoug in different configuration: http://forums.iis.net/t/1154954.aspx) Matej

更新#2 :这个夜晚涉及到的事实,即Thread.GetHash code()用来打印出线程标识符在我们的日志外商投资企业可能会改变。请参见 ASP.NET - Thread.GetHash code()更改

UPDATE#2: This night be related to fact, that Thread.GetHashCode() which is used to print out the thread identifier in our log fies could change. See ASP.NET - Thread.GetHashCode() changes

推荐答案

我认为这可能是下降到调试到文件,不能够处理所有这些事件。写文件有它的局限性。

I think it could be down to debugging to file, not being able to handle all these events. Writing to file has its limitations.

我建议使用默认的调试跟踪,你可以看到在 DebugView中

I suggest using default debug trace which you can see in DebugView.

这篇关于的Application_BeginRequest不是在强调环境被解雇的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆