软件程序员 [英] Software programmer

查看:98
本文介绍了软件程序员的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个网站(这是我的第一个网站)。该站点应该从安装并分散在现场的硬件控制器中轮询和存储数据。

I am developing a web(this my first site). this site is supposed to poll and store data from hardware controllers which are installed and dispersed in the field.

是否可能网站中的代码可以在即使没有客户端连接到站点,或者我必须编写一个单独的程序来轮询控制器并填满数据库,然后在连接
a客户端时读取数据库。

Is it possible that the code in the web site could run this task in the background even if no client is connected to the site, or do I have to write a separate program which poll the controller and fill up a database, and then read the database when a client is connected.

当然 我更喜欢第一个选项。

Of course I prefer the the first option.

提前谢谢

David Anidjar   

David Anidjar   

推荐答案

It取决于你正在使用什么技术。

在基于.NET Framework的Web应用程序(Asp.net)中,计时器经常用于按计划的时间间隔执行活动,因此使用计时器似乎是适当的我的解决方案。
您可以从
Global.asax 中的 Application_Start 处理程序启动计时器来运行计划任务。遗憾的是,此解决方案通过应用程序域,进程或系统重新启动不稳定,因为必须向应用程序发出请求才能启动计时器。 ASP.NET是一种被动的
编程范例,它只响应HTTP请求,因此进程或用户输入必须调用代码才能运行它。
这就是我不建议您采用第一种方法的原因

In .NET Framework-based web applications (Asp.net), timers are frequently used to perform activities at scheduled intervals, so using one would seem to be an appropriate solution. You could start a timer from the Application_Start handler in Global.asax to run your scheduled tasks. Unfortunately, this solution is not robust through application domain, process, or system restarts because a request must be made to the application to start the timer. ASP.NET is a passive programming paradigm that only responds to HTTP requests, so a process or user input must call the code for it to run. This is the reason I would not recommend you to go with your first approach.

基本上,您可以编写Windows服务(单独的代码块)来汇集所需的数据。使用Windows服务的优点是可以直接使用托管的.NET
代码。


这篇关于软件程序员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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