无法访问 raw.githubusercontent.com

huangapple go评论79阅读模式
英文:

Unable to access raw.githubusercontent.com

问题

我想通过raw.githubusercontent.com在GitHub上下载一些文件。

在使用golang实现这个功能时,我遇到了以下错误:

dial tcp: lookup raw.githubusercontent.com: getaddrinfow: The requested name is valid, but no data of the requested type was found.

我的代码:

url1 := "https://raw.githubusercontent.com/pupillord/tiny-cs/main/README.md"

// 上述提到的错误将在这里出现
resp, err := http.Get(url1)

注意:
如果我直接在网站上打开它,我可以正常访问该文件。

英文:

I want to download some files in github by raw.githubusercontent.com.

When using golang to implement this function, I encountered the following error:

dial tcp: lookup raw.githubusercontent.com: getaddrinfow: The requested name is valid, but no data of the requested type was found.

My code:

url1 := "https://raw.githubusercontent.com/pupillord/tiny-cs/main/README.md"

// the error mentioned above will appear here
resp, err := http.Get(url1)

Note:
If I open it directly on the website, I can access the file normally.

答案1

得分: 0

这个错误消息与Winsock的WSANO_DATA错误代码相关。它意味着你尝试连接的域名的DNS记录存在问题。

请参考这里:
https://learn.microsoft.com/en-us/windows/win32/winsock/windows-sockets-error-codes-2#WSANO_DATA

  1. 我认为重新启动服务器可能会解决问题。
  2. 你应该调查一下你的环境的DNS设置。
  3. 如果你手动输入了地址,请确保拼写正确。
  4. 尝试手动输入URL。
英文:

This error message is associated with the Winsock WSANO_DATA error code. It means, there is some problem with DNS record of the domain name you are trying to connect to.

See here :
https://learn.microsoft.com/en-us/windows/win32/winsock/windows-sockets-error-codes-2#WSANO_DATA

  1. I think restarting server might fix it.
  2. you should investigate your environment's DNS settings
  3. If you manually entered the addres, make sure that the spelling is
    correct
  4. try entering the URL manually

huangapple
  • 本文由 发表于 2022年1月6日 12:02:01
  • 转载请务必保留本文链接:https://go.coder-hub.com/70602310.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定