gpt4 book ai didi

mongodb - 无法从 Azure Functions 连接到 Atlas MongoDB

转载 作者:行者123 更新时间:2023-12-02 23:57:54 27 4
gpt4 key购买 nike

我刚刚创建了一个 Azure 函数,它应该连接到 Atlas 上的 MongoDB 实例,基本上遵循本教程:

https://www.mongodb.com/blog/post/how-to-integrate-azure-functions-with-mongodb

从我使用 Visual Studio 进行的本地开发来看,一切正常,我可以连接到 Atlas 环境,但是当我在 Azure 上部署代码时,出现以下异常:

A timeout occurred after 30000ms selecting a server using CompositeServerSelector{ Selectors = MongoDB.Driver.MongoClient+AreSessionsSupportedServerSelector, LatencyLimitingServerSelector{ AllowedLatencyRange = 00:00:00.0150000 }, OperationsCountServerSelector }. Client view of cluster state is { ClusterId : "1", ConnectionMode : "ReplicaSet", Type : "ReplicaSet", State : "Disconnected", Servers : [{ ServerId: "{ ClusterId : 1, EndPoint : "Unspecified/ltdevcluster-shard-00-00.qkeby.mongodb.net:27017" }", EndPoint: "Unspecified/ltdevcluster-shard-00-00.qkeby.mongodb.net:27017", ReasonChanged: "Heartbeat", State: "Disconnected", ServerVersion: , TopologyVersion: , Type: "Unknown", HeartbeatException: "MongoDB.Driver.MongoConnectionException: An exception occurred while opening a connection to the server.---> MongoDB.Driver.MongoConnectionException: An exception occurred while receiving a message from the server.---> System.IO.EndOfStreamException: Attempted to read past the end of the stream.

如果我将网络访问设置为“无处不在”,一切都会正常工作。

现在,在Atlas的网络访问面板中,我在我的功能应用=>网络=>入站流量和出站流量下添加了从Azure门户检索的IP(总共1个IP用于入站,3个IP用于出站) .

但是添加这 4 个 IP 并没有解决问题。

我还应该做什么?

最佳答案

关于mongodb - 无法从 Azure Functions 连接到 Atlas MongoDB,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69125997/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com