How to run Azure Function locally within Visual Studio on HTTPS?(如何在 HTTPS 上的 Visual Studio 中本地运行 Azure Function?)
问题描述
我有一个在 Visual Studio 中开发的 C# 库 Azure Function (v1 .Net Framework 4.6.1).
I have a C# library Azure Function (v1 .Net Framework 4.6.1) developed in Visual Studio.
我想在 HTTPS 上的 Visual Studio 中本地运行它.我怎样才能做到这一点?
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.ServerinDebug
et461host.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>
这篇关于如何在 HTTPS 上的 Visual Studio 中本地运行 Azure Function?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在 HTTPS 上的 Visual Studio 中本地运行 Azure Function?


- 良好实践:如何重用 .csproj 和 .sln 文件来为 CI 创建 2022-01-01
- 如何用自己压缩一个 IEnumerable 2022-01-01
- 带有服务/守护程序应用程序的 Microsoft Graph CSharp SDK 和 OneDrive for Business - 配额方面返回 null 2022-01-01
- C# 中多线程网络服务器的模式 2022-01-01
- WebMatrix WebSecurity PasswordSalt 2022-01-01
- 输入按键事件处理程序 2022-01-01
- MoreLinq maxBy vs LINQ max + where 2022-01-01
- 在哪里可以找到使用中的C#/XML文档注释的好例子? 2022-01-01
- C#MongoDB使用Builders查找派生对象 2022-09-04
- Web Api 中的 Swagger .netcore 3.1,使用 swagger UI 设置日期时间格式 2022-01-01