如何在HTTPS上的Visual Studio中本地运行Azure函数?
我有一个在Visual Studio中开发的C#库Azure函数(v1 .Net Framework 4.6.1).
I have a C# library Azure Function (v1 .Net Framework 4.6.1) developed in Visual Studio.
我想在Visual Studio的HTTPS上本地运行它.我该如何实现?
I want to run this locally within Visual Studio on HTTPS. How can I achieve this?
我将应用程序参数设置如下:
I have set my application arguments as follows:
host start --port 7112 --pause-on-error --useHttps --cors *
添加--usehttps
会导致应用程序无法正确启动.
Adding --usehttps
results in the application not starting correctly.
应用程序启动时,询问我是否要安装证书,请单击是".
When the application starts it asks if I want to install a certificate, I click yes.
然后控制台窗口显示此消息,并且应用程序似乎无法正确加载-最后的消息不断重复.
Then console window shows this and the application doesnt seem to load correctly - the final message just keeps repeating.
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.
(Aside; I am trying to do this because I think it might help with this).
请尝试在Powershell中使用以下命令创建测试证书
Please try creating a test cert using following commands in 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)
这是启动功能主机的命令
and here is the command to start functions host
func host start --port 7112 --useHttps --cors * --cert certificate.pfx --password <password>