asp.net - 带有 Visual Studio 2017 和 IIS Express 的 ngrok 无法连接

标签 asp.net visual-studio-2017 twilio iis-express ngrok

因此,根据此处的 twilio 文档,我正在尝试将我的开发机器设置为能够响应某些 webhooks:

https://www.twilio.com/docs/usage/tutorials/how-use-ngrok-windows-and-visual-studio-test-webhooks

我已经安装了 ngrok,并启动并运行了隧道,指向在 Visual Studio 中指定的端口。在本例中,为 44336。
enter image description here
enter image description here

但是,如果我去访问外部 URL,我的加载时间很长,最终会出现 502 错误。访问 localhost 按预期工作正常。

因此,我尝试将 ngrok 设置为指向 8080,并且我取得了一些进展,但仍然没有运气在浏览器中出现以下错误消息。

enter image description here

通过第一次隧道尝试,我可以看到 GET/请求出现在 ngrok 客户端中,但没有错误。在第二次尝试中,我可以看到 502 错误:

enter image description here

所以我有两个问题:如何诊断问题的根源?以及如何设置 IIS 以接受来自 ngrok 的连接?

最佳答案

这已在最新版本的 ngrok(此时为 2.3.23)中得到解决。

可以在此处引用相关的已关闭问题:https://github.com/inconshreveable/ngrok/issues/448

您现在可以运行:

ngrok http https://localhost:<port> -host-header="localhost:<port>"

对于您的示例:
ngrok http https://localhost:44336 -host-header="localhost:44336"

关于asp.net - 带有 Visual Studio 2017 和 IIS Express 的 ngrok 无法连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52192673/

相关文章:

asp.net - 如何在 ASP.NET WebForms 应用程序旁边运行 OWIN 代码?

c++ - 键入循环时如何修复 visual studio 自动完成?

azure - 如何升级现有云服务项目以使用 Azure SDK 3.0?

python-3.x - 如何在使用 Twilio 的 python 中继续运行客户端程序

node.js - Twilio 应答机检测

javascript - 在尝试为另一个应用程序设置新设备时不释放 Twilio.Device 实例

c# - 创建一个set get类并在构造函数中传递参数

c# - 在静态类中返回多个值

xamarin - Xamarin 项目没有 PCL 选项

asp.net - RedirectToPage() 在 ASP.NET Core 3 Razor 页面中不起作用