我在 app-harbor 上托管了 1 名后台工作人员用于发送电子邮件。从过去的 3 到 4 天,它无法正常工作,我收到错误“Terminated with exitcode -2147467259”。
以下是在后台工作人员中使用的脚本:
静态无效主要(字符串 [] 参数)
{
while (true)
{
//Worker_Process_For Send Email
EmailCls.SendEmail_ByMailGun("a@b.com", "a@b.com", "Testing Shailesh-live", "body-live");
}
}
公共静态IRestResponse SendEmail_MailGun(字符串从,字符串到,字符串主题,字符串正文)
{
RestClient client = new RestClient();
client.BaseUrl = ConfigurationManager.AppSettings["mailgun_baseurl"].ToString();// "https//api.mailgun.net/v2";
client.Authenticator = new HttpBasicAuthenticator("api", ConfigurationManager.AppSettings["mailgun_key"].ToString());
var mailgun_domain = ConfigurationManager.AppSettings["mailgun_domain"].ToString();
RestRequest request = new RestRequest();
request.AddParameter(mailgun_domain,mailgun_domain, ParameterType.UrlSegment);
request.Resource = "{" + mailgun_domain + "}/messages";
request.AddParameter("from", from);
request.AddParameter("to", to);
request.AddParameter("subject", subject);
request.AddParameter("html", body);
request.Method = Method.POST;
return client.Execute(request);
}
给定的脚本在本地机器上工作正常,但不是来自 appharbor 。