gpt4 book ai didi

c# - 如何在 HTTPS 上的 Visual Studio 中本地运行 Azure Function?

转载 作者:行者123 更新时间:2023-11-30 12:20:32 27 4
gpt4 key购买 nike

我有一个在 Visual Studio 中开发的 C# 库 Azure Function (v1 .Net Framework 4.6.1)。

我想在 HTTPS 上的 Visual Studio 中本地运行它。我怎样才能做到这一点?

我已将我的应用程序参数设置如下:

host start --port 7112 --pause-on-error --useHttps --cors * 

添加 --usehttps 会导致应用程序无法正常启动。

应用程序启动时询问我是否要安装证书,我单击是。

然后控制台窗口显示这个并且应用程序似乎没有正确加载 - 最后的消息一直重复。

Listening on https://localhost:7112/
Hit CTRL-C to exit...
[10/07/2018 15:52:58] Reading host configuration file 'C:\Application.Server\bin\Debug\net461\host.json'
[10/07/2018 15:52:58] Host configuration file read:
[10/07/2018 15:52:58] {}
The host is taking longer than expected to start.

(旁白;我正在尝试这样做,因为我认为这可能对 this 有帮助)。

最佳答案

请尝试在 powershell 中使用以下命令创建测试证书

$cert = New-SelfSignedCertificate -Subject localhost -DnsName localhost -FriendlyName "Functions Development" -KeyUsage DigitalSignature -TextExtension @("2.5.29.37={text}1.3.6.1.5.5.7.3.1")

Export-PfxCertificate -Cert $cert -FilePath certificate.pfx -Password (ConvertTo-SecureString -String <password> -Force -AsPlainText)

这是启动主机功能的命令

func host start --port 7112 --useHttps --cors * --cert certificate.pfx --password <password>

关于c# - 如何在 HTTPS 上的 Visual Studio 中本地运行 Azure Function?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51269657/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com