多线程与asp.net窗口服务 [英] Multi thread with window service in asp.net

查看:129
本文介绍了多线程与asp.net窗口服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以使用相同的过程在多线程?

Can I use the same process in multiple threads?

有5类:


  • 类别1 - 100000邮件发送

  • 2类 - 10000 mail发送

  • 3类 - 200000 mail发送

  • 第4类 - 1000 mail发送

  • 5类 - 300000 mail发送

这是正在使用的两个线程

主题的时间来发送邮件每个cateogry:[主题1]花了40分钟,1类; [线程2]花了10分钟,第2类
[类别3]应该由线程2和随机服用其他类别后有所回升。我使用Asp.net在backgorund工艺窗口服务。

Thread time to send mail for each cateogry: [Thread 1] Took 40 mins for category 1; [Thread 2] took 10 mins for category 2 [Category 3] should be picked up by Thread 2 and after that randomly taking other categories. I am using Asp.net with Window service in backgorund process.

这是获得邮件详细方法: SendNewsLatterStatus
使[类别3]与线程2继续,之后随机服用
在Thread类..
在与backgorund工艺窗口服务asp.net。

This is the method to get the mail detail : SendNewsLatterStatus so that [Category 3] is continuing with Thread 2 and after that randomly taking category in Thread .. In asp.net with Window service in backgorund process.

            NewsLatterThread1 = new Thread(new ThreadStart(SendNewsLatterStatus));
            NewsLatterThread1.Name = "NewsLatter1";

            NewsLatterThread2 = new Thread(new ThreadStart(SendNewsLatterStatus));
            NewsLatterThread2.Name = "NewsLatter2";

            NewsLatterThread1.Start();
            NewsLatterThread2.Start();

            NewsLatterThread1.Join();
            NewsLatterThread2.Join();

            NewsLatterThread1.Abort();
            NewsLatterThread2.Abort();

它不能正常工作是什么错误为

It's not properly working what is the mistake for that

推荐答案

您需要先明确你的线程的概念。

You need to first clear out your concept of threading.

阅读 http://www.albahari.com/threading/
这必将清新的空气,以及将整理您的查询。

Read this http://www.albahari.com/threading/ This will surely clear air as well as will sort out your query.

这篇关于多线程与asp.net窗口服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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