Message from discussion
stopping the MongoDB service
Date: Sun, 1 Jul 2012 17:10:12 -0700 (PDT)
From: Andrew Heard <and...@aq1systems.com>
To: mongodb-csharp@googlegroups.com
Message-Id: <0a0434d8-9fb7-47c0-b896-7228587f1339@googlegroups.com>
Subject: stopping the MongoDB service
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_Part_1189_19658666.1341187812337"
------=_Part_1189_19658666.1341187812337
Content-Type: multipart/alternative;
boundary="----=_Part_1190_26267921.1341187812338"
------=_Part_1190_26267921.1341187812338
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
My C# WinForms program has code to install and/or start the MongoDB service
before using the C# driver - this works fine. I would now like to be able
to stop the MongoDB service when the program exits - the service is only
used by this program, and users have noticed operating system messages
about having to stop the service when uninstalling or upgrading the C#
program which they shouldn't have to encounter. I know from
the CSharp+Driver+Quickstart there is mention that "You do NOT need to call
Connect or Disconnect" I agree which is generally true.
I have (roughly):
var sc = new ServiceController("MongoDB");
:
server.Disconnect(); // may not do anything? or may have to wait?
sc.Stop(); // ==> System.InvalidOperationException' occurred in
System.ServiceProcess.dll
thanks in advance for any suggestions
------=_Part_1190_26267921.1341187812338
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit
My C# WinForms program has code to install and/or start the MongoDB service before using the C# driver - this works fine. I would now like to be able to stop the MongoDB service when the program exits - the service is only used by this program, and users have noticed operating system messages about having to stop the service when uninstalling or upgrading the C# program which they shouldn't have to encounter. I know from the CSharp+Driver+Quickstart there is mention that "You do NOT need to call Connect or Disconnect" I agree which is generally true.<div><br></div><div>I have (roughly):</div><div><div> var sc = new ServiceController("MongoDB");</div></div><div> :</div><div><div> server.Disconnect(); // may not do anything? or may have to wait?</div><div> sc.Stop(); // ==> System.InvalidOperationException' occurred in System.ServiceProcess.dll</div><div><br></div></div><div>thanks in advance for any suggestions</div>
------=_Part_1190_26267921.1341187812338--
------=_Part_1189_19658666.1341187812337--