Ozu*_*ure 5 .net mongodb mongodb-query asp.net-core
我正在尝试使用 .net Core 连接到 Mongo DB,但是在调用 api 时出现超时错误。我遵循了本教程:https://medium.com/swlh/how-to-use-a-mongodb-database-in-a-asp-net-core-web-api-application-b0451ae314f5
您可以在这个 git 存储库中查看本教程的完整代码: https: //github.com/walpoles93/AspNetCoreMongoDb
我还尝试下载此存储库并添加我的 mongo 用户和密码,但仍然出现相同的错误。我得到的错误是:
System.TimeoutException: A timeout occured after 30000ms selecting a server using CompositeServerSelector{ Selectors = MongoDB.Driver.MongoClient+AreSessionsSupportedServerSelector, LatencyLimitingServerSelector{ AllowedLatencyRange = 00:00:00.0150000 } }. Client view of cluster state is { ClusterId : "1", ConnectionMode : "ReplicaSet", Type : "ReplicaSet", State : "Disconnected", Servers : [{ ServerId: "{ ClusterId : 1, EndPoint : "Unspecified/cluster0-shard-00-00.tvnqj.mongodb.net:27017" }", EndPoint: "Unspecified/cluster0-shard-00-00.tvnqj.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 创建 .Net Core API 的 Microsoft 官方文档。
使用 ASP.NET Core 和 MongoDB 创建 Web API
希望我能帮一点忙。
| 归档时间: |
|
| 查看次数: |
3787 次 |
| 最近记录: |