部署错误:以受限制访问权限访问套接字

作者:佚名

时间:2024-03-25

来源:stackoverflow

浏览:349

我在go中创建了一个azure函数。该功能在本地机器上运行正常。但是,当我将其部署到azure时,出现以下异常:尝试以访问权限禁止的方式访问套接字。内部异常方法为:system.net.http.connecthelper+d__1.movenext错误日志在这里:https://github.com/mpurusottamc/azurefunc-go/blob/master/errorlog.jsonlocal.settings.json文件包含以下代码:{"ise

在部署 Azure 函数时,出现了“尝试以访问权限禁止的方式访问套接字”异常。该错误在本地运行正常,但部署到 Azure 时却出现问题。问题原因是 Go 语言版本不兼容,更新 Go 版本并强制部署后解决了问题。

问题内容

我在 go 中创建了一个 azure 函数。该功能在本地机器上运行正常。但是,当我将其部署到 azure 时,出现以下异常:

尝试以访问权限禁止的方式访问套接字。

内部异常方法为:system.net.http.connecthelper+<connectasync>d__1.movenext

错误日志在这里:https://github.com/mpurusottamc/azurefunc-go/blob/master/errorlog.json

local.settings.json 文件包含以下代码:

{
    "isencrypted": false,
    "values": {
        "functions_worker_runtime": "node",
        "azurewebjobsstorage": "<proper storage link>"
    }
}

host.json 文件具有 golang 可执行文件引用作为工作线程。

{
    "version": "2.0",
    "logging": {
        "applicationInsights": {
            "samplingSettings": {
                "isEnabled": true
            }
        }
    },
    "httpWorker": {
        "description": {
            "defaultExecutablePath": "hello.exe"
        }
    },
    "extensionBundle": {
        "id": "Microsoft.Azure.Functions.ExtensionBundle",
        "version": "[1.*, 2.0.0)"
    }
}

我的代码托管在 github 上:https://github.com/mpurusotamc/azurefunc-go

deploy.sh 文件包含部署脚本。

遵循此参考文章:https://itnext.io/write-azure-functions-in-any-language-with-the-http-worker-34d01f522bfd

我错过了什么吗?


解决方案


我在我的机器上将 golang 版本更新到了 1.14。并且还在部署脚本中应用了 --force ,这为我解决了问题。

go.mod 更新如下:

module hello

go 1.14

更新部署脚本以包含 --force 参数

func azure functionapp 发布 hellogoapp --force

今天关于《部署错误:以受限制访问权限访问套接字》的内容介绍就到此结束,如果有什么疑问或者建议,可以在golang学习网公众号下多多回复交流;文中若有不正之处,也希望回复留言以告知!

本文内容来源于互联网,如有侵权请联系删除。

相关文章

更多

热门专题

更多
返回顶部