是否可以使用调度程序或Windows服务在服务器上上传文件?

时间:2019-08-20 07:05:37

标签: asp.net-mvc quartz-scheduler backgroundworker

  1. 我正在尝试使用Crystal Job Scheduler进行文件上传。但是,它不起作用。
  2. 是否可以使用作业或Windows服务将文件上传到服务器。
  3. 我已经用谷歌搜索,但了解不多。请提供一些链接以供参考。

1 个答案:

答案 0 :(得分:0)

我想可以使用Windows服务上传文件。我们构建了一种类似的Windows服务,用于以递归方式插入数据库。[1]:https://www.c-sharpcorner.com/article/create-windows-services-in-c-sharp/

protected override void OnStart(string[] args)
            {
                WriteToFile("Service is started at " + DateTime.Now);
                Fileupload();
                timer.Elapsed += new ElapsedEventHandler(OnElapsedTime);
                timer.Interval = 1000*60*60*10; //number in milisecinds  
                //timer.Interval = 1000 * 60;
                timer.Enabled = true;
             }
private void OnElapsedTime(object source, ElapsedEventArgs e)
        {
            Fileupload();
            WriteToFile("Service is recall at " + DateTime.Now);
        }

///您可以在Serivce Cs文件中使用以上两个函数,并定义用于上传文件的自定义文件上传功能。希望这对您有用