iisnode在处理请求时遇到错误.HRESULT:0x6d HTTP状态:500 HTTP子状态:1013 [英] iisnode encountered an error when processing the request. HRESULT: 0x6d HTTP status: 500 HTTP subStatus: 1013

查看:115
本文介绍了iisnode在处理请求时遇到错误.HRESULT:0x6d HTTP状态:500 HTTP子状态:1013的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用ReactJS作为前端开发一个Web应用程序,并为后端进行开发.我正在将应用程序部署到天蓝色.

I'm developing a webapp using ReactJS for the frontend and express for the backend. I'm deploying my app to azure.

要测试我的请求是否通过,我编写了两个不同的API请求.

To test if my requests are going through I wrote two different API requests.

第一个非常简单:

router.get('/test', (req, res) => {
  res.send('test was a success');
});

然后在前端,我有一个按钮,当单击该按钮时发出请求,并得到响应测试成功".每次都可以.

Then in the frontend I have a button which when clicked makes the request and I get the response 'test was a success'. This works every time.

第二项测试是:

router.post('/test-email', (req, res) => {
  let current_template = 'reset';
  readHTMLFile(__dirname + '/emails/' + current_template + '.html', function(err, html) {
    let htmlSend;
    let template = handlebars.compile(html);
    let = replacements = {
      name: req.body.name
    };
    htmlSend = template(replacements);
    let mailOptions = {
      from: 'email@email.com',
      to: 'someone@email.com',
      subject: 'Test Email',
      html: htmlSend
    };
    transporter.sendMail(mailOptions)
    .then(response => {
      res.send(response);
    })
    .catch(console.error);
   });
 });

然后,当我部署该应用程序时,我会致电这些测试中的每一个.就像我提到的那样,第一个总是成功.第二个应该发送一封非常简单的电子邮件的大多数时间都失败,并显示错误"iisnode在处理请求时遇到错误.HRESULT:0x6d HTTP状态:500 HTTP subStatus:1013".奇怪的是,电子邮件偶尔会发送一次,但是这种情况很少发生.在大多数情况下,请求会在发送有错误的响应之前只花两分钟.

Then when I've deployed the app I make a call to each one of these tests. The first one, like I mentioned always succeeds. The second one which is supposed to send a very simple email fails most of the time with the error "iisnode encountered an error when processing the request. HRESULT: 0x6d HTTP status: 500 HTTP subStatus: 1013". The strange thing is that every once in a while the email will send but this happens very rarely. Most times the request will take exactly two minutes before sending a response with an error.

我应该注意,在localhost中进行开发时,两个测试始终可以正常工作,只有在生产中(部署到天蓝色)才会发生这种情况.

I should note that when in development in localhost both tests work all the time with no issues whatsoever, it's only when in production (deployment to azure) that this happens.

最近几天我一直在挖掘,却一无所获.任何帮助或指示将不胜感激.

I've been digging around for the last few days and came up with nothing. Any help or directions would be greatly appreciated.

推荐答案

我发现了问题所在.我使用gmail发送我的测试电子邮件,默认情况下,如果gmail认为发出请求的应用程序不安全,它将阻止任何尝试使用该帐户的尝试.只需单击第一次尝试时它们自动发送给您的链接,即可轻松解决此问题.马上不明显的是,当您进入生产模式时,它们会添加另一级别的安全性,在这种情况下,我认为这是一个验证码,尽管您可以在部署应用程序后立即在开发中发送电子邮件就是这种情况.

I found out what the problem was. I'm using gmail to send my test emails, by default gmail will block any attempts to use an account if it thinks the app making the request is not secure. This can be easily fixed by simply clicking the link they automatically send you when you make your first attempt. What is not immediately obvious is when you go in production mode they add another level of security which in this case I believe is a captcha, and while you'll be able to send emails in development as soon as you deploy your app this no longer becomes the case.

无论如何,在深入研究之后,我找到了禁用验证码的选项,现在我的电子邮件可以正常发送了!

Anyway, after digging around a little more I found the option to disable the captcha and now my emails send fine!

链接到该选项 https://accounts.google.com/b/0/DisplayUnlockCaptcha

希望这会对某人有所帮助.

Hopefully this will help someone.

这篇关于iisnode在处理请求时遇到错误.HRESULT:0x6d HTTP状态:500 HTTP子状态:1013的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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