Shutdown with Command

0 views
Skip to first unread message

Stefan Agner

unread,
Aug 13, 2010, 11:37:39 AM8/13/10
to mongodb-csharp
Hello,

Latly I started a project using MongoD and mongodb-sharp, and I'm very
happy with it so far! I tried to shutdown the Server from my
application, and used this command:
mongo["admin"].SendCommand("shutdown");

This works, the server exits gracefully, but I get an
MongoConnectionException (using git trunk). The Command tries to read
the result, but the connection is already closed. Is there a solution
for this?

Thanks
Stefan

Steve Wagner

unread,
Aug 13, 2010, 1:41:48 PM8/13/10
to mongodb...@googlegroups.com
The simples solution would be to catch the MongoConnectionException. The
protocol defines that there have to be a response, so when the server
close the connection before sending the response, we can not do much.
And since this is no case that happens 1000times a second, its ok to
simply catch the exception.

-Steve

Reply all
Reply to author
Forward
0 new messages