服务在特定时间每天运行 [英] Service to run everyday at a certain time

查看:95
本文介绍了服务在特定时间每天运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述







我目前正在尝试创建一个需要在特定时间(18:00)运行的流程。



对我来说最好的方法是什么?



我的应用是基于网络的app。

Hi


I am currently trying to create a process that needs to run at a certain time(18:00).

What would be the best way for me to do this?

My aplication is a web based app.

推荐答案

那么这个过程非常简单。试试这样



1.创建一个控制台应用程序,它将执行以下操作

1.1获取与数据库的连接

1.2开发文件导出机制

1.3开发FTP文件到服务器的FTP文件

2.创建一个Windows调度程序任务

3。配置任务在18:00运行



这就是你需要做的一切。如果您不知道如何安排任务,请按照以下网址。



配置预定任务项 [ ^ ]
Well in that case the process will be very simple. Try like this

1. Create a Console Application which will do following
1.1 Get connectivity to the database
1.2 Develop export mechanism to file
1.3 Develop FTP mechanism to FTP file to the servers
2. Create a windows scheduler task
3. Configure task to run on 18:00

Thats all you have to do. Please follow below url in case you dont know how to schedule the task.

Configure a Scheduled Task Item[^]


最好的方法是使用配置文件和日志文件创建Windows服务,而不是复杂的实现



1.Visual Basic Projects-> Windows服务

2.创建工作线程并实现您的功能

3.从设置中读取配置.ini文件

4.将数据写入数据文件

5.在命令提示符下使用-service命令在Window中注册服务



例如: - C:\ Myservicefolder \ myservice.exe -service



6.运行 - > services.msc找到你的服务然后开始它



服务将会停止,直到你停止服务(如果可能,服务为自动服务)



7.取消注册服务(如果不再需要)



C:\ Myservicefolder \ myservice.exe unregserver





此服务可以使用客户端服务器从服务器到客户端的应用程序用于交换数据服务器中的主机服务
Best way is to create a Windows Service with a configuration file and Log File than going for a complex implementation

1.Visual Basic Projects->Windows Service
2.Create the Worker threads and Implement your functionality
3.Read Configuration from Settings.ini file
4.Write data to a data file
5.Register the service in Window using -service command from command prompt

Eg:- C:\Myservicefolder\myservice.exe -service

6. Run-> services.msc find your service then start it

The service will be ruing until you stop it (If possible make service as Automatic)

7. Unregistering service (If no longer needed)

C:\Myservicefolder\myservice.exe unregserver


This service can be acessed using a Client server Application from server to client for exchange of data Host service in Server


这篇关于服务在特定时间每天运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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