Send emails in background job/scheduled task in asp.net mvc 3

雨燕双飞 提交于 2020-01-09 09:07:31

问题


I have an ASP.NET MVC 3 web app hosted on normal hosting, (i.e., no owned or virtual server), and I would like to be able to store e-mails say in a database and have them picked up and sent in a background job of sorts.

If this was my own server I'd write a Windows Service to handle this, but is there any way I could implement/simulate a scheduled task/background job in a web application process?


回答1:


You may take a look at Quartz.NET. There is a blog post about how you could make it running in medium trust.




回答2:


You can take a look at this post (http://blog.stackoverflow.com/2008/07/easy-background-tasks-in-aspnet/) which explains on how run scheduled tasks without using windows service, in asp.net or asp.net mvc.




回答3:


You can also use job cash:

 HttpContext.Current.Cache.Add("jobkey",  
                         "jobvalue", null,  
                         DateTime.MaxValue,  
                         TimeSpan.FromSeconds(15), // set the time interval  
                         CacheItemPriority.Default, JobCacheRemoved); 

For Details See this



来源:https://stackoverflow.com/questions/5159761/send-emails-in-background-job-scheduled-task-in-asp-net-mvc-3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!