“getaddrinfo:名称解析中的临时失败”在RoR应用程序中

时间:2021-07-14 10:45:25

I'm trying to retrieve emails from gmail using pop3 to my rails applicaiton. I get the error - "getaddrinfo: Temporary failure in name resolution" when i try to retrieve the email.

我正在尝试使用pop3检索gmail到rails应用程序的电子邮件。当我试图检索电子邮件时,我得到了“getaddrinfo:名称解析暂时失败”的错误。

the weird thing is, it works when i try it at home but not at my university. i'm guessing it has something to do with the internet connection.

奇怪的是,当我在家而不是在大学里尝试的时候,它确实有效。我猜这和网络连接有关。

please help!

请帮助!

4 个解决方案

#1


3  

I had the same problem just started getting this error out of the blue in a RoR application that connects to an API using a RestClient running on a local virtual machine using Vagrant that I have as a development environment.

我刚刚在RoR应用程序中遇到了同样的问题,该应用程序使用运行在本地虚拟机上的RestClient连接到API,使用的是作为开发环境的Vagrant。

The only thing that fixed the issue was simply restarting my virtual machine. Just done a vagrant down & up command, then rackup and back in the game.

解决这个问题的唯一办法就是重新启动我的虚拟机。刚刚做了一个流浪的下降和上升的命令,然后在游戏中重新振作。

#2


1  

This generally means you aren't getting a response from DNS. Your university connection is probably behind a proxy preventing you from directly accessing the Internet. If so, this proxy must be specified in your code. Check your POP3 library documentation, or failing that, you may be able to use a library like socksify that redirects TCP connections through your SOCKS proxy.

这通常意味着您没有收到来自DNS的响应。你的大学连接可能是阻止你直接访问互联网的代理。如果是,则必须在代码中指定此代理。检查您的POP3库文档,或者失败了,您可能可以使用像socksify这样的库,通过您的SOCKS代理重定向TCP连接。

#3


0  

Simple. You may be directed through a proxy server. Set up a new connection ,set up your college settings,restart your server and it should work.

简单。您可以通过代理服务器。设置一个新的连接,设置你的大学设置,重新启动你的服务器,它应该可以工作。

#4


0  

ssh into your server and check if the machine is able to resolve the domain.

ssh到您的服务器,检查机器是否能够解析域。

ping <your_site> should resolve the domain name to IP.

ping 应该将域名解析为IP。

If its not resolving correctly, then there is some problem in your hosting service.

如果它没有正确地解决问题,那么您的托管服务存在一些问题。

quick fix: You can manually map domain-to-ip in the etc/hosts file of your server.

快速修复:您可以在服务器的etc/hosts文件中手动映射域到ip。

#1


3  

I had the same problem just started getting this error out of the blue in a RoR application that connects to an API using a RestClient running on a local virtual machine using Vagrant that I have as a development environment.

我刚刚在RoR应用程序中遇到了同样的问题,该应用程序使用运行在本地虚拟机上的RestClient连接到API,使用的是作为开发环境的Vagrant。

The only thing that fixed the issue was simply restarting my virtual machine. Just done a vagrant down & up command, then rackup and back in the game.

解决这个问题的唯一办法就是重新启动我的虚拟机。刚刚做了一个流浪的下降和上升的命令,然后在游戏中重新振作。

#2


1  

This generally means you aren't getting a response from DNS. Your university connection is probably behind a proxy preventing you from directly accessing the Internet. If so, this proxy must be specified in your code. Check your POP3 library documentation, or failing that, you may be able to use a library like socksify that redirects TCP connections through your SOCKS proxy.

这通常意味着您没有收到来自DNS的响应。你的大学连接可能是阻止你直接访问互联网的代理。如果是,则必须在代码中指定此代理。检查您的POP3库文档,或者失败了,您可能可以使用像socksify这样的库,通过您的SOCKS代理重定向TCP连接。

#3


0  

Simple. You may be directed through a proxy server. Set up a new connection ,set up your college settings,restart your server and it should work.

简单。您可以通过代理服务器。设置一个新的连接,设置你的大学设置,重新启动你的服务器,它应该可以工作。

#4


0  

ssh into your server and check if the machine is able to resolve the domain.

ssh到您的服务器,检查机器是否能够解析域。

ping <your_site> should resolve the domain name to IP.

ping 应该将域名解析为IP。

If its not resolving correctly, then there is some problem in your hosting service.

如果它没有正确地解决问题,那么您的托管服务存在一些问题。

quick fix: You can manually map domain-to-ip in the etc/hosts file of your server.

快速修复:您可以在服务器的etc/hosts文件中手动映射域到ip。