在网站项目中运行线程的地方 [英] where run thread in website project

查看:72
本文介绍了在网站项目中运行线程的地方的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


i想在我的网站上运行3个线程,但我不在哪里放线程运行?

例如运行线程?:

RouteConfig



WebApiConfig



FilterConfig



全局文件

请帮帮我



i希望这些线程始终运行。

解决方案

这听起来像是一种非常错误的方法。 运行线程不能成为目标。它可能只是一种用于实现某些目标的技术。



因此,这个问题几乎没有任何意义。此外,由于Web技术的本质,在Web项目中使用线程几乎在所有情况下都没有任何意义。请记住,代码的整个生命周期都在于某些HTTP请求和HTTP响应之间。



最后,你要问的选项提一些数据文件。没有将线程放在文件中这样的事情。整个概念毫无意义。



-SA


假设您要发送一些电子邮件使用代码或文本消息到他/她的手机或想要在数据库中保存一些东西。然后在网络中使用线程,否则它是没用的。

Thread.Start()使用它。

hi i want to run 3 thread in my website but i don't where put the thread run?
for example where run thread?:
RouteConfig
or
WebApiConfig
or
FilterConfig
or
global file
please help me

i want these threads always run.

解决方案

It sounds as a wildly wrong approach to me. "Running a thread" cannot be a goal. It could be only a techniques used to reach some goals.

So, the question hardly can make any sense. Moreover, using threads in a Web project, due to the very nature of Web technology, makes no to little sense in almost all cases. Remember that the whole lifetime of your code behind lies between some HTTP request and HTTP response.

And, finally, the "options" you are asking about mention some data files. There is no such thing as "put a thread in a file". The whole notion makes no sense.

—SA


Suppose you want to send some email using code or a text message to his/her mobile phone or want to save something in the database.then use the thread in web otherwise it is of no use.
Thread.Start() use this.


这篇关于在网站项目中运行线程的地方的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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