如何在HTTPS中运行发布到文件夹的Blazor应用程序作为.exe。

huangapple go评论70阅读模式
英文:

How to run Blazor application published to folder as .exe in HTTPS

问题

当我将我的Blazor WebAssembly应用程序发布到我的计算机上的文件夹并运行可执行文件时,我可以通过以下地址访问该应用程序:

> 信息: Microsoft.Hosting.Lifetime[14]
现在侦听中: http://localhost:5000

但是,我需要以HTTPS方式运行该应用程序。如何在运行.exe文件时实现这一点?

英文:

When I publish my Blazor WebAssembly application to a folder on my machine and run the executable, I am able to access the application at the following address:

> info: Microsoft.Hosting.Lifetime[14]
Now listening on: http://localhost:5000

如何在HTTPS中运行发布到文件夹的Blazor应用程序作为.exe。

如何在HTTPS中运行发布到文件夹的Blazor应用程序作为.exe。

如何在HTTPS中运行发布到文件夹的Blazor应用程序作为.exe。

However, I need to run the application as HTTPS. How can I do this running the .exe?

答案1

得分: 2

You can configure Kestrel in your appsettings.json file

Simple example

{
  "AllowedHosts": "*",
  "Kestrel": {
    "Endpoints": {
      "HttpsInlineCertFile": {
        "Url": "https://localhost:5001",
        "Certificate": {
          "Path": "cert/MyCert.pfx",
          "Password": "1234567890"
        }
      }
    }
  }
}
英文:

You can configure Kestrel in your appsettings.json file

Simple example

{
  "AllowedHosts": "*",
  "Kestrel": {
    "Endpoints": {
      "HttpsInlineCertFile": {
        "Url": "https://localhost:5001",
        "Certificate": {
          "Path": "cert/MyCert.pfx",
          "Password": "1234567890"
        }
      }
    }
  }
}

huangapple
  • 本文由 发表于 2023年6月8日 16:24:50
  • 转载请务必保留本文链接:https://go.coder-hub.com/76429941.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定