“getaddrinfo:名称解析暂时失败”在RoR应用中
我正在尝试使用 pop3 从 gmail 检索电子邮件到我的 Rails 应用程序。当我尝试检索电子邮件时,出现错误 -“getaddrinfo:名称解析暂时失败”。
奇怪的是,当我在家尝试时它有效,但在我的大学却无效。我猜这与互联网连接有关。
请帮忙!
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.
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我遇到了同样的问题,刚刚开始在 RoR 应用程序中突然出现此错误,该应用程序使用在本地虚拟机上运行的 RestClient 连接到 API,并使用我作为开发环境的 Vagrant。
解决该问题的唯一方法就是重新启动我的虚拟机。刚刚做了一个流浪者下来& up 命令,然后上架并返回游戏。
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.
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.
这通常意味着您没有从 DNS 获得响应。您的大学连接可能位于代理后面,阻止您直接访问互联网。如果是这样,则必须在您的代码中指定此代理。检查您的 POP3 库文档,如果失败,您也许可以使用像ocksify 这样的库,通过 SOCKS 代理重定向 TCP 连接。
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.
简单的。您可能会通过代理服务器被引导。建立一个新的连接,设置你的大学设置,重新启动你的服务器,它应该可以工作。
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.
ssh 进入您的服务器并检查机器是否能够解析域。
ping
应该将域名解析为 IP。如果无法正确解析,则表明您的托管服务存在问题。
快速修复:您可以在服务器的
etc/hosts
文件中手动将域名映射到 IP。ssh into your server and check if the machine is able to resolve the domain.
ping <your_site>
should resolve the domain name to 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.