昨天,我可以使用VS代码运行和调试Azure函数项目。今天,当我点击F5 (“开始调试”)时,会立即出现一个弹出
ECONNREFUSED 127.0.0.1:9091
我认为这是一个网络问题,因为VS代码甚至没有打开显示“执行任务.”的终端。
但是在VS代码中,我可以浏览扩展市场,在终端中运行"pip“。
这是我的配置:
launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current file",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
},
{
"name": "Azure Functions",
"type": "python",
"request": "attach",
"port": 9091,
"preLaunchTask": "func: host start"
}
]
}tasks.json
{
"version": "2.0.0",
"tasks": [
{
"type": "func",
"command": "host start",
"problemMatcher": "$func-python-watch",
"isBackground": true,
"dependsOn": "pipInstall",
"options": {
"cwd": "${config:azureFunctions.projectSubpath}"
}
},
{
"label": "pipInstall",
"type": "shell",
"command": "${config:python.pythonPath} -m pip install -r requirements.txt",
"problemMatcher": [],
"options": {
"cwd": "${config:azureFunctions.projectSubpath}"
}
}
]
}settings.json
{
"azureFunctions.deploySubpath": "azure-functions\\my_project",
"azureFunctions.projectSubpath": "azure-functions\\my_project",
"azureFunctions.scmDoBuildDuringDeployment": true,
"azureFunctions.pythonVenv": ".venv",
"azureFunctions.projectLanguage": "Python",
"azureFunctions.projectRuntime": "~3",
"debug.internalConsoleOptions": "neverOpen",
"python.pythonPath": "C:\\Users\\myself\\BigRepo\\azure-functions\\my_project\\.venv\\Scripts\\python.exe",
"powershell.codeFormatting.addWhitespaceAroundPipe": true
//"terminal.integrated.shell.windows": "&&"
}发布于 2021-08-09 12:35:01
这太奇怪了。我反复编辑了我的launch.json,有时它是有效的,有时不是,现在当我保存我的原始launch.json时,配置可以工作。
这种配置工作得很好:
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current file",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
},
{
"name": "Azure Functions",
"type": "python",
"request": "attach",
"port": 9091,
"preLaunchTask": "func: host start"
}
]
}我不知道怎么回事。
发布于 2021-12-10 19:52:37
重新安装所有东西。
它起作用了。
https://stackoverflow.com/questions/68708788
复制相似问题