繁体   English   中英

Errno :: ECONNREFUSED(无法打开TCP连接到:80(连接被拒绝 - 连接(2)nil端口80))

[英]Errno::ECONNREFUSED (Failed to open TCP connection to :80 (Connection refused - connect(2) for nil port 80))

我正在尝试使用库HTTParty ,但每当我运行下面的代码时,我都会收到错误。

码:

require 'httparty'
response = HTTParty.get('http://example.com')

当我运行代码时,我收到错误: Errno::ECONNREFUSED (Failed to open TCP connection to :80 (Connection refused - connect(2) for nil port 80)) 当我在net/http运行相同的代码时,我没有收到任何错误。 我不知道这是否有帮助,但我运行的系统是Linux Mint 18.3 Cinnamon 64-bit。

我知道这已经很晚了,但使用https://example.com而不是http://example.com是我的问题的解决方案。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM