Asp.net-Core

用於 asp.net 核心應用程序的 ngrok 和 https 隧道

  • March 30, 2022

從 Visual Studio 啟動的 ASP.NET CORE 應用程序的地址為https://localhost:44313/。要測試性能,您需要製作隧道。我使用 ngrok 和命令:

ngrok http -host-header=localhost 44313

但這不適用於 https。

任何人都可以分享一個工作範例嗎?

  1. 下載目前版本的 ngrok
  2. 註冊並獲取令牌:https ://dashboard.ngrok.com/auth
  3. 執行 ngrok 並使用以下命令設置令牌:ngrok authtoken YOUR_AUTHTOKEN
  4. 創建隧道: ngrok http -host-header=localhost https://localhost:44313

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(http s而不是 http)

引用自:https://stackoverflow.com/questions/54800512