【问题标题】:Azure function call other API,failed with 'A connection attempt failed because the connected party did not properly respond after a period of time,,,'Azure 函数调用其他 API,失败并显示“连接尝试失败,因为连接方在一段时间后没有正确响应,,,”
【发布时间】:2021-11-03 06:48:17
【问题描述】:

Azure 函数(Timer trigger) 使用 Restsharp 对其他外部 API 进行 REST 调用,失败并出现错误 'A connection attempt failed because the connected 方在一段时间后没有正确响应,或者建立连接失败,因为连接的主机未能响应。连接尝试失败,因为连接方在一段时间后没有正确响应'

外部 API 提供商已将我的所有 Azure 函数应用出站 IP 和本地系统列入白名单,代码在本地运行很好,但在 azure 上发布后,azure 函数会抛出此错误。

我们wrote code 在 Azure 函数中获取 IP,当 azure 函数在 azure 上运行时,它会从出站 IP 地址提供一个并列入白名单。

还有其他东西被防火墙阻止吗?请在外部调用任何参考时,azure 函数实际上做了什么。

【问题讨论】:

    标签: azure azure-functions restsharp


    【解决方案1】:

    感谢ZainD365 发布您的suggestion 作为帮助其他社区成员的答案。

    连接尝试失败,因为连接方没有 一段时间后正确响应,,,

    “这个错误可以通过创建Azure Virtual Network NAT gateway来解决。然后将webservice防火墙上的静态IP地址列入白名单。”

    有关类似问题的更多信息,请参阅以下链接:

    GitHub 问题:Troubleshooting HttpRequestException "A connection attempt failed because the connected party did not properly respond..."

    所以线程:How to call an API using time trigger Azure function

    【讨论】:

    • 谢谢,我会检查并在这里更新。
    • 我们的客户已将我们提供给他们的 IP 列入白名单,但他们确实犯了错误,因此一旦 IP 正确列入白名单,它就可以正常工作。无论如何,其他人将其标记为无用的答案。
    猜你喜欢
    • 2016-08-30
    • 1970-01-01
    • 1970-01-01
    • 2013-06-13
    • 2020-06-19
    • 2014-01-07
    • 1970-01-01
    • 2011-10-29
    相关资源
    最近更新 更多