首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >连接拒绝- "freegeoip.net“端口80的连接(2)

连接拒绝- "freegeoip.net“端口80的连接(2)
EN

Stack Overflow用户
提问于 2014-06-12 20:57:53
回答 1查看 888关注 0票数 2

环境

  • Rails 4.0.4
  • 红宝石2.0.1
  • 地编码器gem

问题

今天,我的应用程序坏了,我无法在日志中解决这个问题:

代码语言:javascript
复制
Errno::ECONNREFUSED (Connection refused - connect(2) for "freegeoip.net" port 80):

看起来它是相关的,所以地理编码宝石

如果这个问题不发生在开发环境中的话,那就更奇怪了。

我检查了freegeoip,看上去好像坏了,这说明我不知道为什么要阻止我的应用程序运行。

代码语言:javascript
复制
$ curl http://freegeoip.net 
curl: (7) couldn't connect to host
EN

回答 1

Stack Overflow用户

发布于 2014-06-13 12:35:48

我是怎么解决的

代码语言:javascript
复制
begin
  @location =  "#{request.location.city} #{request.location.country_code}"
rescue => e
  # handle the error here
  logger.debug "http://freegeoip.net must be down!"
  logger.debug e.message
end
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24193774

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档