How to execute asp.NET code in scheduled task of windows?
相关问题
- Carriage Return (ASCII chr 13) is missing from tex
- How to store image outside of the website's ro
- 'System.Threading.ThreadAbortException' in
- Request.PathInfo issues and XSS attacks
- How to dynamically load partial view Via jquery aj
相关文章
- asp.net HiddenField控件扩展问题
- asp.net HiddenField控件扩展问题
- Asp.Net网站无法写入错误日志,测试站点可以,正是站点不行
- asp.net mvc 重定向到vue hash字符串丢失
- FormsAuthenticationTicket expires too soon
- “Dynamic operations can only be performed in homog
- What is the best way to create a lock from a web a
- Add to htmlAttributes for custom ActionLink helper
ASP.Net has good integration with Windows Workflow (WF). I've accomplished 2 project with such integration. WF allows persists tasks, so it is independent on IIS restarting or system crash
If you have full access to the server, use the scheduled tasks.
If you do not have access (shared hosting), create a webpage/service that you can call to trigger the action. Be aware that the "action" is limited in time.
You could create a small application, that you can schedule on you own computer to call the remote server, to trigger the action.
There is no way to schedule ASP.NET code from within a web application, because the web is stateless.
My preferred method to schedule .NET code, is to write a windows service that I install on the web server. See. http://blog.dogma.co.uk/search/label/windowsservice.
An quicker, less efficient, way is to add the code to a page and execute that page from Windows Scheduled Tasks.
Rich
I've often used wget / curl to do exactly this from windows scheduled tasks (or even from cron on a different server). For certain things it is better to keep it all within the web application.
e.g.
or
The simplest and probably the easiest way to do this is to make the code a command line app and then execute it using the Windows Scheduler found in Control Panel.