开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜