Linux出现“Could not resolve: api.weixin.qq.com (Could not contact DNS servers)”解决办法 在请求微信小程序服务时候报错了,如下图: 从这个报错,可以很明显的发现是域名解析不了; 1、故障排查 因为代码里调用的是curl,所以测试一下curl是否能够正常解析dns; curl api.weixing.qq.com 果然不行! 2、解决办法 vi /etc/resolv.conf 添加或者修改 DNS nameserver 114.114.114.114 nameserver 8.8.8.8 重新测试curl,问题得到解决。 赞 3 赏 分享