mongo-csharp-driver 2.0 / nservicebus.mongodb 2.1 无法再连接到 Mongo
mongo-csharp-driver 2.0 / nservicebus.mongodb 2.1 can no longer connect to Mongo
我们最近将 NserviceBus.MongoDb 软件包从 2.0.3 更新到 2.1。这还将 mongo-csharp-driver 包从 1.10 更新到 2.0.1。我们现在在服务启动时看到以下异常:
2015-07-08 11:29:16,589 [1] WARN NServiceBus.MongoDB.Internals.MongoHelpers [(null)] <(null)> - Mongo could not be contacted using: server201.localco.test:27017.
If you are using a Replica Set, please ensure that all the Mongo instance(s) server201.localco.test:27017 are available.
To configure NServiceBus to use a different connection string add a connection string named "NServiceBus/Persistence" in your config file.
Reason: System.InvalidOperationException: There is no current primary.
at MongoDB.Driver.MongoServer.Ping()
at NServiceBus.MongoDB.Internals.MongoHelpers.VerifyConnectionToMongoServer(MongoClientAccessor mongoClientAccessor) in d:\Development\NServiceBus.MongoDB\src\NServiceBus.MongoDB\Internals\MongoHelpers.cs:line 50
我们的 nservicebus 端点配置中唯一相关的行是:
configuration.UsePersistence<MongoDBPersistence>();
我们的连接字符串是:
<add name="NServiceBus.Persistence" connectionString="mongodb://server201.localco.test/?replicaSet=rs0" />
如果我 uninstall/rollback 2.1/2.0.1 到 2.0.3/1.10 (nservicebus.mongodb/mongo-csharp-driver) 错误消失。
更新:我看到数据库本身(带有 TimoutData 集合)实际上是在 Mongo...
中创建的
更改您的连接字符串
<add name="NServiceBus.Persistence" connectionString="mongodb://server201.localco.test/?replicaSet=rs0" />
到
<add name="NServiceBus/Persistence/MongoDB" connectionString="mongodb://server201.localco.test/?replicaSet=rs0" />
或者像上面那样保留并将名称设置为
config
.UsePersistence<MongoDbPersistence>()
.SetConnectionStringName("NServiceBus.Persistence");
来自 Github/Nuget 的软件包的最新版本已经解决了这个问题。 See bug report
我们最近将 NserviceBus.MongoDb 软件包从 2.0.3 更新到 2.1。这还将 mongo-csharp-driver 包从 1.10 更新到 2.0.1。我们现在在服务启动时看到以下异常:
2015-07-08 11:29:16,589 [1] WARN NServiceBus.MongoDB.Internals.MongoHelpers [(null)] <(null)> - Mongo could not be contacted using: server201.localco.test:27017. If you are using a Replica Set, please ensure that all the Mongo instance(s) server201.localco.test:27017 are available. To configure NServiceBus to use a different connection string add a connection string named "NServiceBus/Persistence" in your config file. Reason: System.InvalidOperationException: There is no current primary. at MongoDB.Driver.MongoServer.Ping() at NServiceBus.MongoDB.Internals.MongoHelpers.VerifyConnectionToMongoServer(MongoClientAccessor mongoClientAccessor) in d:\Development\NServiceBus.MongoDB\src\NServiceBus.MongoDB\Internals\MongoHelpers.cs:line 50
我们的 nservicebus 端点配置中唯一相关的行是:
configuration.UsePersistence<MongoDBPersistence>();
我们的连接字符串是:
<add name="NServiceBus.Persistence" connectionString="mongodb://server201.localco.test/?replicaSet=rs0" />
如果我 uninstall/rollback 2.1/2.0.1 到 2.0.3/1.10 (nservicebus.mongodb/mongo-csharp-driver) 错误消失。
更新:我看到数据库本身(带有 TimoutData 集合)实际上是在 Mongo...
中创建的更改您的连接字符串
<add name="NServiceBus.Persistence" connectionString="mongodb://server201.localco.test/?replicaSet=rs0" />
到
<add name="NServiceBus/Persistence/MongoDB" connectionString="mongodb://server201.localco.test/?replicaSet=rs0" />
或者像上面那样保留并将名称设置为
config
.UsePersistence<MongoDbPersistence>()
.SetConnectionStringName("NServiceBus.Persistence");
来自 Github/Nuget 的软件包的最新版本已经解决了这个问题。 See bug report