使用 ngrok 公开本地 Web 服务器时无响应

No response while using ngrok to expose a local web server

我正在尝试使用 ngrok 公开我的本地 Web 服务器 IIS Express。 按照 https://ngrok.com/docs 中的步骤并启动了隧道,但无法得到响应。

Screenshot - ngrok fired

我正在通过 IIS Express 使用 Visual studio。 (调试模式,本地网站运行良好。) 如果本地网站没有启动,访问XXXXX.eu.ngrok.io会直接报错:

Failed to complete tunnel connection

The connection to https://2713343d.eu.ngrok.io was successfully tunneled to your ngrok client, but the client failed to establish a connection to the local address localhost:44320.Make sure that a web service is running on localhost:44320 and that it is a valid address.The error encountered was: dial tcp [::1]:44320: connectex: No connection could be made because the target machine actively refused it.

Ngrok 的 Web 界面上也没有显示任何错误。

有什么方法可以检查出问题在哪里?或查看 ngrok 的日志?

尝试将您的服务设置为 http,而不是 https。

确实它适用于http,但强烈建议使用https,因此您应该正确启动ngrok才能使用https:

ngrok http -host-header=localhost https://localhost:{your_IIS_express_port}

在此之后您应该可以访问您的 URL:

https://{id}.ngrok.io