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?
基础教程推荐
- SSE 浮点算术是否可重现? 2022-01-01
- 有没有办法忽略 2GB 文件上传的 maxRequestLength 限制? 2022-01-01
- 如何在 IDE 中获取 Xamarin Studio C# 输出? 2022-01-01
- 将 Office 安装到 Windows 容器 (servercore:ltsc2019) 失败,错误代码为 17002 2022-01-01
- 为什么Flurl.Http DownloadFileAsync/Http客户端GetAsync需要 2022-09-30
- MS Visual Studio .NET 的替代品 2022-01-01
- 将 XML 转换为通用列表 2022-01-01
- c# Math.Sqrt 实现 2022-01-01
- rabbitmq 的 REST API 2022-01-01
- 如何激活MC67中的红灯 2022-01-01