运行 Azure Functions with VS Code instanlty 因 ECONNREFUSED 而失败
Running Azure Functions with VS Code instanlty fails with ECONNREFUSED
昨天我可以 运行 并使用 VS Code 调试我的 Azure Function 项目。今天,当我按下 F5(“开始调试”)时,一个弹出窗口立即出现
connect ECONNREFUSED 127.0.0.1:9091
我认为这是网络问题,因为 VS Code 甚至没有打开显示“正在执行任务 [...]”的终端。
但在 VS Code 中我可以浏览扩展市场,运行 在终端中“pip install”。
这是我的配置:
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": "&&"
}
这太奇怪了。我来回编辑我的 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"
}
]
}
我不确定我明白发生了什么事。
重新安装所有内容。
有效。
昨天我可以 运行 并使用 VS Code 调试我的 Azure Function 项目。今天,当我按下 F5(“开始调试”)时,一个弹出窗口立即出现
connect ECONNREFUSED 127.0.0.1:9091
我认为这是网络问题,因为 VS Code 甚至没有打开显示“正在执行任务 [...]”的终端。
但在 VS Code 中我可以浏览扩展市场,运行 在终端中“pip install”。
这是我的配置:
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": "&&"
}
这太奇怪了。我来回编辑我的 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"
}
]
}
我不确定我明白发生了什么事。
重新安装所有内容。
有效。