首页 > 解决方案 > Azure 函数 - Python - Visual Studio 代码

问题描述

我正在尝试在 Azure Functions 中执行 Hello World 代码。我正在从 Visual Studio Code 调用 python 代码 - Azure Function 中的博客存储触发器。

我没有对 init.py 进行任何更改。我收到以下错误:

Found Python version 3.8.0 (py).
Azure Functions Core Tools (3.0.2881 Commit hash: fa9641ad925588192888bc977ff****************)
Function Runtime Version: 3.0.14287.0
A host error has occurred during startup operation '7bad93bb-xxxx-4da0-9461-55fc9deaxxxx'.
System.Net.Http: Error while copying content to a stream. System.Net.Security:  Received an unexpected EOF or 0 bytes from the transport stream.  
Value cannot be null. (Parameter 'provider')
Application is shutting down...
The terminal process "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Command .venv\Scripts\activate ; func host start" terminated with exit code: 1.

关于必须做些什么来解决这个问题的任何帮助?谢谢。

标签: pythonazurevisual-studio-codeazure-functions

解决方案


由于您没有更改代码中的任何内容,因此您的函数在上传到 azure 后应该可以工作。

该错误似乎与 tls 版本有关。

如果只想简单测试一下,可以直接在 Azure 上创建一个基于 python 的函数应用。

如果您使用的是 blob 触发器,它实际上会将数据转换为流。因此,可以使用普通的python脚本进行模拟,只需要在模拟完成后放入azure函数的函数体中即可。

另外,还是希望大家能展示一下代码和配置文件。(如果没有问题,应该在 Azure 上运行良好,问题应该是本地的。)


推荐阅读