ASP.NET CORE应用程序在Visual Studio中启动时,地址为https://localhost:44313/。 要测试性能,需要创建一个隧道。我使用ngrok和以下命令:
ngrok http -host-header=localhost 44313
但这对于https无效。
有人可以分享一个可用的示例吗?
ASP.NET CORE应用程序在Visual Studio中启动时,地址为https://localhost:44313/。 要测试性能,需要创建一个隧道。我使用ngrok和以下命令:
ngrok http -host-header=localhost 44313
但这对于https无效。
有人可以分享一个可用的示例吗?
更新于2019年4月11日
使用ngrok版本2.3.29并添加了authtoken(不确定authtoken是否会影响结果,我只是按照在线安装指南添加了它)。
这个命令对我有效:
ngrok http https://localhost:{your-app-port} -host-header=localhost:{your-app-port}
与现有答案的区别:我将localhost:port传递给-host-header
与您的问题的区别:我使用ngrok http https://localhos:port
代替ngrok http http://localhos:port
(https而不是http)
现在您需要在主机标头之前放置两个横线
ngrok http https://localhost:{your-app-port} --host-header=localhost:"your-app-port"
更新至2023年3月。
在尝试以上所有选项均失败后,我从他们的文档中找到了以下内容:https://ngrok.com/docs/secure-tunnels/tunnels/http-tunnels/#host-header
要进行http隧道
e.g
ngrok http --host-header=rewrite http://localhost:44345
如果使用https, 例如
ngrok http --host-header=rewrite --scheme=https https://localhost:44345
如果您需要在免费计划上运行多个隧道,可以修改配置如下:
version: "2"
authtoken: 2OS8VCciyOWXR7XM33rh6RY79jT_7u8VsgzzfwoewzGnfG3lV
tunnels:
first:
addr: 5173
proto: http
second:
proto: http
addr: https://localhost:7125
host_header: rewrite
schemes: [https]
然后运行
ngrok start --all
查找配置运行
ngrok config check