英文:
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
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"
}
}
}
}
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论