在IIS应用程序中使用的任务/线程池(ASP .NET) [英] Using tasks/ ThreadPool on IIS application (asp .net)

查看:797
本文介绍了在IIS应用程序中使用的任务/线程池(ASP .NET)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个IIS的asp.net应用程序7.我们需要创建一个异步过程中做计算(使用Web服务),而不是保存在客户端等待,我们使用线程池来做到这一点(我喜欢的任务,但我是一个服务器端的家伙)结果
我的问题是:?结果
1如果使用IIS上的一个线程池没有考虑从IIS池中的线程从客​​户或从OS < BR>
2.你会使用什么样的任务或线程池(任务给你更多的我知道,但在UI家伙像池)。结果

We have an asp.net application on an iis 7. we need to create an async process to do calculating (using a web service) and not keeping the client waiting, we used ThreadPool to do that (i prefer Tasks but i am a server side guy).
My questions are :
1. if using a thread pool on iis does it take threads from the iis pool from clients or from the OS ?
2. What would you use Tasks or ThreadPool (Tasks give you much more i know but the UI guys like the pool).
Tanks

推荐答案

在ASP.NET主机提供每个进程的一个单独的线程池。所以,如果你使用线程池,那么它采取的是从服务器请求绘制同一池中。

The ASP.NET host provides a single thread pool per process. So if you're using ThreadPool, then it's taking from the same pool that is drawn from for server requests.

这就是说,如果你开始后台操作是的独立,那么你应该使用Win32服务,Web服务,消息队列系统,或者类似的东西。运行ASP.NET中的背景线程违背IIS的整个体系结构;它更容易正确地扩展和做其他IT工作(例如,重新启动应用程序池),如果你保持HTTP的无状态特性。

That said, if you're starting background operations that are independent from a single client request, then you should be using a Win32 service, web service, message queue system, or something similar. Running "background" threads in ASP.NET goes against the entire architecture of IIS; it's much easier to scale properly and do other IT work (e.g., restarting app pools) if you maintain the stateless nature of HTTP.

这篇关于在IIS应用程序中使用的任务/线程池(ASP .NET)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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