global.asax中的Application_Start()事件 [英] Application_Start() event in global.asax

查看:134
本文介绍了global.asax中的Application_Start()事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

伙计们, 我的网站有成千上万的用户...我已经实现了每天向每个用户发送邮件一次的后台任务...我点击了此链接以执行此操作...

Hai guys, My website has thousands of users... I have implemented a background task of sending mails to every user once a day ... I followed this link to do this...

http://www.codeproject.com/KB/aspnet/ASPNETService.aspx

我的问题是,每一个访问我网站的用户都会触发Application_Start()...如果这样,每个用户每天都会收到n封邮件,所以我想避免它...

My question is will Application_Start() will be fired for every user hitting my website... If so every user will be receiving a n number of mails daily so i want to avoid it...

推荐答案

Application_Start和Application_End方法是不表示HttpApplication事件的特殊方法. ASP.NET在应用程序域的生存期内调用它们一次,而不是在每个HttpApplication实例中调用它们.

The Application_Start and Application_End methods are special methods that do not represent HttpApplication events. ASP.NET calls them once for the lifetime of the application domain, not for each HttpApplication instance.

因此,当第一个用户打开该网站时,它将在未命中后单击application_start方法.

So When first user will open the site it will hit the application_start method after that it will not.

我要补充一点,您试图做的事是有风险的.如果要批量发送电子邮件,则可能需要考虑可以每天发送电子邮件的Scheduler.

I will add that what you are trying to do is risky. If you want to do batch email sending then you may want to think about Scheduler which can send emails daily.

这篇关于global.asax中的Application_Start()事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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