connectex: No connection could be made because the target machine actively refused it.

connectex: No connection could be made because the target machine actively refused it.,第1张

关于阿里云服务器出现以下错误的原因:

connectex: No connection could be made because the target machine actively refused it.

出现以上错误的原因是因为对外暴露的接口无法对外访问。那么如果对应的端口确定是已经对外开启了那么其中的一个问题可能是

package main
  
import (
            "fmt"
                "net/http"
        )

        func IndexHandler(w http.ResponseWriter, r *http.Request) {
                    fmt.Fprintln(w, "hello world")
            }

            func main() {
                        http.HandleFunc("/index", IndexHandler)
                        http.ListenAndServe(":8051", nil) //这是正确的写法,
//           http.ListenAndServe("127.0.0.0:8051", nil) //这是错误的写法,

                    }

 

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/995674.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-21
下一篇 2022-05-21

发表评论

登录后才能评论

评论列表(0条)

保存