首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用VS代码实例化运行Azure函数的ECONNREFUSED失败

使用VS代码实例化运行Azure函数的ECONNREFUSED失败
EN

Stack Overflow用户
提问于 2021-08-09 08:10:29
回答 2查看 2.7K关注 0票数 1

昨天,我可以使用VS代码运行和调试Azure函数项目。今天,当我点击F5 (“开始调试”)时,会立即出现一个弹出

ECONNREFUSED 127.0.0.1:9091

我认为这是一个网络问题,因为VS代码甚至没有打开显示“执行任务.”的终端。

但是在VS代码中,我可以浏览扩展市场,在终端中运行"pip“。

这是我的配置:

launch.json

代码语言:javascript
复制
{
        "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

代码语言:javascript
复制
{
    "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

代码语言:javascript
复制
{
    "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": "&&"
    }
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2021-08-09 12:35:01

这太奇怪了。我反复编辑了我的launch.json,有时它是有效的,有时不是,现在当我保存我的原始launch.json时,配置可以工作。

这种配置工作得很好:

代码语言:javascript
复制
{
    "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"
        }
    ]
}

我不知道怎么回事。

票数 0
EN

Stack Overflow用户

发布于 2021-12-10 19:52:37

重新安装所有东西。

它起作用了。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68708788

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档