azure - API 调用在 powershell Azure Functions 中不起作用
问题描述
我正在尝试在 Azure 函数中使用 powershell 运行一个简单的 API 调用
$Headers = @{
"Accept" = "*/*"
"Authorization" = "Bearer "+ $Token
"accept-encoding" = "gzip"
"content-type"="application/json"
"content-length" = "2"
}
$uri = "https://www.example.com/api/vl/$test
$response = Invoke-WebRequest -Uri $uri -Method Delete -Headers $Headers
Write-Host $response.Content
上述命令在我的 PC 上使用 powershell 工作,删除请求已执行。但是在 Azure 函数中,它有以下错误:
Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host
我花了很多时间来解决这个问题,根据我的在线研究,我尝试允许 TLS1.0 和 http;在应用服务编辑器中增加 host.json 文件中的函数超时;并设置 PSWorkerInProcConcurrencyUpperBound = 1。但它们都不起作用。知道这里有什么问题吗?
我对 Azure Function 和 Powershell 非常陌生,因此非常感谢任何帮助。
解决方案
推荐阅读
- c++ - 模板函数中从 'const int*' 到 'int*' 的无效转换
- java - 如何从现有文件夹结构创建 Maven 项目?
- javascript - 我正在尝试向对象添加属性,但只有最后一个被附加
- python - 使用 pandas python 将使用 date_range 生成的索引添加到数据框
- c++ - Use template from dependent type
- angularjs - Scope 函数执行,但 HTML 从未更改
- keycloak - Keycloak:用户提交注册表后自动登录
- vhdl - 如何在 modelsim 中使用泛型数组类型?
- python - 将代码从 keras 移植到 tf.keras
- scala - 减少的参数太多 [Scala 中的 Flink 1.9]