如何在C#,. asp.net中安排任务 [英] How to schedule a task in C# , .asp.net

查看:70
本文介绍了如何在C#,. asp.net中安排任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的专家,







1开始执行计划任务的逐步方法。任务调度程序

2.应用程序是C#,. aspx应用程序。

3..aspx应用程序调用存储过程。

< br $>




请求。



如何设置整个过程?



如何从C#,ASP.NET应用程序调用存储过程。



你在哪里放置存储过程运行。



即页面加载或...





我不想在ms sql server中使用Job Scheduler。







谢谢



我尝试过的事情:



我查看了一个数字网络上的相关解决方案,但没有很好地制定这个请求。

Dear Expert,

A stepwise approach to run a schedule task from the

1. Task scheduler
2. The application is a C#, .aspx application.
3. The .aspx application calls a stored procedure.



Request.

How do you set the whole process ?

How to call the stored procedure from C#, ASP.NET application.

Where do you place the stored procedure to run.

i.e. Page Load or ...


I don't want to use the Job Scheduler in ms sql server.



Thanks

What I have tried:

I have looked at a number of related solutions on the web, but not well formulated to this request.

推荐答案

对于基于网站的应用程序,你需要设置一个sched托管服务中的uled任务。如果您的托管服务使用WebsitePanel(许多人都这样做)那么它就相当明显了。以您的帐户管理员身份登录,然后单击计划任务图标。单击添加计划任务并将任务类型设置为检查网站可用性 - 这允许您从URL运行aspx文件,甚至可以从您自己的域运行。该页面可以在您需要的服务器上执行任何操作。
For a website-based application, you need to set up a scheduled task within your hosting service. If your hosting service uses WebsitePanel (and many do) then it's fairly obvious. Log in as your account admin, and click on the "Scheduled tasks" icon. Click "Add Scheduled Task" and set the "Task Type" to "check Web site Availability" - this allows y
you to run a aspx file from a URL, even from your own domain. That page can do anything on the server that you need.


Googleasp.net计划任务,这是一个非常常见的问题。



asp.net是一个request \ response技术,这意味着你通过浏览器发出请求,你的代码运行并返回一个响应。因为你错过了请求元素,这使得它成为调度任务的非常差的候选者。



你将不得不安排别的向您发出请求,例如计划任务或服务,但如果您租用的是网络空间而不是您自己的服务器,那么它们中的任何一个都不太可能得到支持。另一种方法是使用quartz.net之类的东西,它将使用计时器和线程在给定时间内在您的站点中运行代码,这将适用于任何托管解决方案,但问题是该站点需要运行才能工作除非您的网站全天候使用,否则您无法保证,因为如果IIS处于非活动状态,IIS将关闭您的网站。
Google "asp.net scheduled task", this is a very frequently asked question.

asp.net is a request\response technology which means you make a request via the browser and your code runs and returns a response. That makes it a very poor candidate for scheduling tasks as you're missing the "request" element.

You're going to have to schedule "something else" that makes the request for you such as a scheduled task or a service, but if you're renting web space and not your own server then it's unlikely either of those will be supported. The alternative is to use something like quartz.net which will use a timer and threading to run code within your site at a given time, this will work on any hosting solution but the problem is that the site needs to be running in order to work and unless your site is in use 24/7 that's something you can't guarantee as IIS will shut your site down if it is inactive.


这篇关于如何在C#,. asp.net中安排任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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