在IIS中启动ASP.NET网站服务上的运行作业 [英] Run job on ASP.NET website service start in IIS

查看:77
本文介绍了在IIS中启动ASP.NET网站服务上的运行作业的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些在Application_Start上调用的方法.它开始于任何用户的首页请求.

I have some method that is invoked on Application_Start. And it starts on first page request by any user.

但是我有另一个应用程序,取决于Application_Start期间触发的任务.

But i have another application, dependent on that task that fires during Application_Start.

因此,如果重新启动IIS/网站,则另一个应用程序无法从网站获取某些数据,直到有人请求正在运行的网站上的页面.

So that if IIS/website is restarted- another application cant get some data from website, until someone requests page on the running website.

有没有一种方法可以在网站启动时运行某些任务;无需用户方面的任何交互,只是要在IIS中启动网站并完成我想要的工作?

Is there a way to run some task on website start; without any interaction from user side, just to start website in IIS and do the job i want?

PS 有关实现体系结构的更多详细信息:
网站启动消息传递服务的实例,并开始通过该服务(位于另一台服务器上)发送消息.我知道最好为这种事情创建wcf或Windows服务,但是有人在我加入该项目之前写了这个网站.因此,客户端(从邮件服务器接收邮件)对网站一无所知.这里的网站只是用于打开/关闭某些消息传递功能的管理面板.

PS more details on implementation architecture:
Website starts an instance of messaging service and starts sending messages through that service(that is located on another server). I know that it would have been better to create wcf or windows service for this kind of things, but someone wrote this website before i was included in this project. So clients(that receive messages from messaging server) do not know anything about website. Here website is just administrative panel to turn on/off some messaging features.

我的解决方案
为我的任务创建了Windows服务.效果很好,在本地系统帐户下写入Windows事件日志没有问题.

My Solution
Created windows service for my task. Works well, under local system account has no problems with writing to windows event logs.

推荐答案

查看此"

此外,您还应该考虑将 Quartz.NET 安装为服务,以便可以远程设置计划的任务.

Also you should consider installing Quartz.NET as a service, so that you can setup scheduled tasks remotely.

这篇关于在IIS中启动ASP.NET网站服务上的运行作业的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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