ASP.NET - Thread.GetHash code()的变化 [英] ASP.NET - Thread.GetHashCode() changes

查看:152
本文介绍了ASP.NET - Thread.GetHash code()的变化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

难道possile的Thread.GetHash code()在ASP.NET

Is it possile that Thread.GetHashCode() changes during execution of a single request in ASP.NET

我们使用Thread.GetHash code()写邮件时日志文件(这是从.NET中的旧code 1.1 timerame - 我知道,.NET 3.0支持线程)。当我们分析日志看起来,就好象一个线程开始处理该请求,然后另一个接管。并且完成它。

We use Thread.GetHashCode() when writing messages to log files (it's a old code from .NET 1.1. timerame - I know that .NET 3.0 supports Thread). When we analyze the logs it looks like, as if one thread started to process the requests and then the other one took over. and finished it.

更新:环境:Windows Server 2008 R2的(64位应用程序池),.NET 3.5,超过30同时放执行的请求,他们中的一些可能需要几分钟的时间,CPU使用率过高, 8 GB内存phyisical, - 用90%-95%,虚拟机(Vmware的)内部执行。我们不使用asnyc HTTP处理程序。

Update: Environment: Windows server 2008 R2, (64 bit application pool), .NET 3.5, more than 30 simultaniously executing request, some of them can take up several minutes, high CPU usage, 8 GB phyisical memory,- 90-95% used, executed inside virtual machine (Vmware). We do not use asnyc HTTP handlers.

更新#2 :我们还打印出AppDomain.GetCurrentThreadId()在Application_Begin / EndRequest这个值也做的的保持不变。 GetHas code的变化()
谢谢,
  马特拉

Update #2: We are also printing out AppDomain.GetCurrentThreadId() in Application_Begin/EndRequest and this value also does not remains the same. GetHasCode changes() Thanks, Matra

推荐答案

要回答我的问题。答案是肯定的 - 线程可以请求的executin期间更改。请参见 http://piers7.blogspot.com/2005/11/threadstatic-详情CallContext中-and_02.html 。即使它的五老耳朵,似乎仍然是真实的; - )

To answer my own question. The answer is Yes - the thread can change during the executin of the request. See http://piers7.blogspot.com/2005/11/threadstatic-callcontext-and_02.html for details. Even though it's five ears old it seems to still be true ;-)

这篇关于ASP.NET - Thread.GetHash code()的变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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