Home:ALL Converter>MongoDB C# driver: waiting for replication timed out

MongoDB C# driver: waiting for replication timed out

Ask Time:2015-06-18T10:58:49         Author:tottishi05

Json Formatter

I use MongoDB 3.0.3 and the C# driver 1.10.0.62.
I have 2 shards and set the writeConcern: W = 2, WTimeout = 5000
When I use the method col.Insert(data, writeConcern) the program always throw exceptions as below:
MongoDB.Driver.MongoWriteConcernException: WriteConcern detected an error 'waiting for replication timed out at shard01'. (Response was { "ok" : 1, "code" : 64, "err" : "waiting for replication timed out at shard01", "n" : NumberLong(0) }).
These exceptions occurs frequently. Does anyone know how to handle them??

Author:tottishi05,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/30905780/mongodb-c-sharp-driver-waiting-for-replication-timed-out
yy