什么是CallContext中和ThreadStatic之间的区别是什么?
What are differences between CallContext and ThreadStatic?
我已经理解的是,在ASP.NET环境存储在CallContext中数据可以在整个请求被持久直到它结束而ThreadStatic可能或可能不工作,因为该请求可以切换线程。我还了解到,HttpContext的是使用CallContext中内部存储的。
I've understood that in an ASP.NET environment data stored in CallContext could be persisted throughout the request until it ends while ThreadStatic may or may not work since the request may switch threads. I've also learned that the HttpContext is internally stored using the CallContext.
在一个普通的应用程序,他们似乎都延续到同一个线程调用。如果不是这样吗?
In a regular application they both seem to persist throughout the same thread call. When isn't this the case?
编辑:在我得知调用上下文是一个抽象的概念在一个线程静态存储的注释。 ASP.NET框架从一个线程的数据明确地移动到该是处理一个请求的下一个。其他框架,要提供线程的灵活性可以做同样为上下文存储。
In the comments I learned that the call context is an abstraction over a thread static store. The ASP.NET framework explicitly moves the data from one thread to the next that is to handle one request. Other framework that wants to provide thread agility could do the same to for contextual storage.
推荐答案很多时候,一个请求将在整个使用同一个线程,但它肯定不会总是如此 - ASP.NET展品的螺纹敏捷。有一个关于此的Spring.NET论坛的。这是指对此事的深入的博客文章。我猜想,进入更多详细信息比你来到这里:)
Very often a request will use the same thread throughout, but it certainly won't always be the case - ASP.NET exhibits thread agility. There's a really useful discussion about this on the Spring.NET forums. This refers to an in-depth blog article about the matter. I suspect that goes into more details than you'll get here :)
什么相互矛盾的信息,你看到了,出于兴趣?
What conflicting information did you see, out of interest?
更多推荐
CallContext中VS ThreadStatic
发布评论