title: Unable to run MongoDB as Service on Windows Server 2012
body: <p>I am trying to run MongoDB as a service on Windows Server 2012 R2 Standard.</p>
  
  <p>Can run it from the console, no problem.</p>
  
  <p>However trying to start the service either with 'net start MongoDB' from the command line or from the services snap in and it fails to start. </p>
  
  <p>The Error message is the 1053 timeout :</p>
  
  <p>"The MongoDB service failed to start due to the following error: The service did not respond to the start or control request in a timely fashion."</p>
  
  <p>"A timeout was reached (600000 milliseconds) while waiting for the MongoDB service to connect."</p>
  
  <p>EventID 7000 and EventID 7009 respectively both timestamped the same as the start entry.</p>
  
  <p>I have seen the examples with the registry mod to the ServicesPipeTimeout and changed it. </p>
  
  <p>However  it is not actually timing out. The call returns instantly, the error messages are both timestamped the same and there is no delay before the error is returned. So this would appear not to be the issue and it therefore makes no difference.</p>
  
  <p>I also tried running the service under different accounts and also elevated the permissions for the account running the service. The service still failed to start.</p>
  
  <p>mongod --config "C:\MongoDB\mongod.cfg" starts it from the console, indicating that nothing in the config itself is causing any error. </p>
  
  <p>However the mongod.cfg is :</p>
  
  <p>systemLog:
    verbosity: 5
    traceAllExceptions: true
    destination: file
    path: X:\data\log\mongodb.log</p>
  
  <p>storage:
    dbPath: X:\data\db\</p>
  
  <p>the "ImagePath" value in the registry is </p>
  
  <p>C:\MongoDB\bin\mongod.exe --config "C:\MongoDB\mongod.cfg" --service</p>
  
  <p>Nothing is written to the Mongo logs so it would appear that whatever is being passed to mongod.exe by the service startup is erroring immediately and the process is not even starting. </p>
  
  <p><a href="https://docs.mongodb.com/manual/reference/program/mongod/" rel="nofollow noreferrer">https://docs.mongodb.com/manual/reference/program/mongod/</a>
  gives a list of command line arguments. Are any of these likely to be useful ? </p>
  
  <p>Are there any debug switches I can pass to the mongod.exe  ? Or other tools ?</p>
  
  <p>Any other ideas how I can actually trap the real reason for the start error ?</p>
  
  <p>Thanks.</p>
  
  <p>Mongo 3.4 Community.</p>