wgp*_*ubs 5 asp.net email asp.net-mvc notifications
我有一个ASP.NET MVC应用程序,它在后端使用NHiberante和SQL Server 2008.需要每天/每周发送事件驱动的通知以及每周发送一般通知.
以下是事件驱动的工作流程如何工作的示例:
所以给定这样的工作流程:
谢谢!
您可以在控制器中添加正常操作
Function SendEmails() As ActionResult
Dim result As String = ""
''//big timeout to handle the load
HttpContext.Server.ScriptTimeout = 60 * 10 ''//ten minutes
result = DoTheActualWork()
''//returns text/plain
Return Content(result)
End Function
Run Code Online (Sandbox Code Playgroud)
然后从计划任务中调用该页面。可以是服务器或任何机器上的计划任务。为此使用 .vbs:
发送电子邮件.vbs:
''//Force the script to finish on an error.
On Error Resume Next
''//Declare variables
Dim objRequest
Dim URL
Set objRequest = CreateObject("Microsoft.XMLHTTP")
''//Put together the URL link appending the Variables.
URL = "http://www.mysite.com/system/sendemails"
''//Open the HTTP request and pass the URL to the objRequest object
objRequest.open "POST", URL , false
''//Send the HTML Request
objRequest.Send
''//Set the object to nothing
Set objRequest = Nothing
Run Code Online (Sandbox Code Playgroud)