You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ngrok无法与正常运行的本地localhost建立连接问题求助

Ngrok无法与正常运行的本地localhost建立连接问题求助

大家好,我现在碰到个棘手的问题,想请各位大佬帮忙排查下:

  • 我本地正常运行着一个基于.NET 8的WebAPI服务,用的是Kestrel服务器,监听在localhost:8080端口,直接访问本地地址是完全正常的
  • 为了把这个本地服务暴露到公网,我用Docker启动了ngrok容器,执行的命令是:
    docker run --net=host -it -e NGROK_AUTHTOKEN=[MyAuthToken] ngrok/ngrok:latest http 8080
    
  • 从ngrok的日志输出来看,容器本身是启动成功的,日志内容如下:

    ngrok (Ctrl+C to quit)
    Help shape K8s Bindings https://ngrok.com/new-features-update?ref=k8s
    Session Status online
    Account nativ bashari (Plan: Free)
    Update update available (version 3.15.1, Ctrl-U to update)
    Version 3.15.0
    Region Europe (eu)
    Latency 62ms
    Web Interface http://0.0.0.0:4040
    Forwarding F...

可是现在ngrok就是没办法和我本地的localhost服务建立有效连接,访问ngrok生成的公网转发地址时,根本无法正常访问到我的WebAPI。有没有朋友能帮我分析下可能的问题点,或者该怎么排查?

备注:内容来源于stack exchange,提问作者נתיב בשארי

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.16 08:14:33