本地使用ngrok时启用https返回502错误

4

我需要调试使用Kestrel托管的asp.net core 2 API中的Webhooks,且仅在https下运行:https://localhost:44338(可访问,正常工作)。

我认为ngrok可能会更快速,但我总是被重定向到502错误。

我尝试了其他帖子中找到的这些组合:

ngrok http -region=eu -bind-tls=true -host-header=rewrite localhost:44338
ngrok http 44338 -region=eu -host-header="localhost:44338"
ngrok.exe http -region=eu -host-header=rewrite localhost:44338
ngrok tls -region=eu -hostname=localhost 44338

添加到

netsh http add urlacl url=https://xxx.ngrok.io:44338/ user=everyone

但是没有变化,有什么想法吗?
编辑:
ngrok http -region=eu -host-header=rewrite localhost:8592
netsh http add urlacl url=http://xxxxxxxx.eu.ngrok.io:8592/ user=everyone

我有同样的问题,你还记得你为此做了什么吗? - ChrisO
我不太记得为什么要这样做,但我在我的代码中注释了http到https的重定向,然后调用了带有编辑添加行的http端点。 - Xav Sc
我们开发了一个免费的VS扩展(抱歉,我不知道您是否使用VS或VS Code,目前只发布了VS扩展),名为Conveyor,具有与ngrok相同的许多功能。https://conveyor.cloud/Help/Writing_webhooks_on_localhost_with_Visual_Studio_and_IIS_Express - Jim W says reinstate Monica
1个回答

0

我刚刚发现自己陷入了同样的困境,我有一个使用Kestrel服务器的.net core 2.2项目,该服务器在端口5001上提供https服务(开箱即用)。

为了使ngrok工作(版本2.3.29-在撰写本文时下载,因为这是我以前从未使用过的新PC)。

只需运行ngrok http https://localhost:5001,即可返回可以用于调试Webhook的URL。

希望这可以帮助到您。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接