shutting down Mongo server from C# Driver API
I want to shutdown the MongoDB server from my C# application when application exits.
I am using RunAdminCommand
of MongoServer
object to do this. Below is the code snippet.
MongoServer server = MongoServer.Create( @"mongodb://localhost:27019" );
server.RunAdminCommand ( @"shutdown" ) ;
The execut开发者_JS百科ion freezes at the second line and never returns back, though I see the server being shut down.
It does not raise any exceptions. I tried with "Common Language Runtime Exceptions" setting of the VS 2010 without any success.
What am I doing wrong?
It seems that there is an issue with MongoDb C# Driver.
From the documentation I found that they are resolving this issue in the version 1.1 of C# Driver.
The fix is available in the latest source code.
--Bharat
精彩评论