0
我已经安排我的控制台应用程序作为在azure门户中的Web作业。如何通过Azure门户的邮件获取天蓝色的Web作业运行警报?
如何从Azure门户邮件中获取Azure Web作业运行警报,了解它是否成功运行或发生任何故障。
我已经安排我的控制台应用程序作为在azure门户中的Web作业。如何通过Azure门户的邮件获取天蓝色的Web作业运行警报?
如何从Azure门户邮件中获取Azure Web作业运行警报,了解它是否成功运行或发生任何故障。
如何从Azure门户邮件中获取Azure Web作业运行警报,以确定其运行是否成功或发生任何故障。
我还没有发现任何方式做它在Azure门户。你可以修改你的代码来实现它。
由于我original posts提到,WebJobs状态一个取决于是否没有任何异常或不执行你的WebJob /功能。我建议你把所有的代码放在try代码块中。如果发生任何异常,则意味着此运行的状态将失败。否则,状态将会成功。
try
{
//Put all your code here
//If no exception throws, the status of this run will be success
//Send success status to your mail
}
catch
{
//If any exception throws, the status of this run will be failure
//Send failure status to your mail
}
要在WebJob发送邮件,你可以使用SendGrid组件或其他任何SMTP客户端库。下面是一个使用SmtpClient以从Hotmail发送邮件的样本。
MailMessage mail = new MailMessage("[email protected]", "[email protected]");
SmtpClient client = new SmtpClient();
client.Port = 587;
client.EnableSsl = true;
client.Credentials = new NetworkCredential("[email protected]", "mail_password");
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.Host = "smtp.live.com";
mail.Subject = "this is a test email.";
mail.Body = "this is my test email body";
client.Send(mail);
几秒钟的搜索:https://github.com/Azure/azure-webjobs-sdk-extensions/wiki/Error-Monitoring –