title: Connecting to MongoDB from azure function
body: <p>I have a problem connecting to a MongoDB from a C# function running on microsoft azure. The function is time triggered, it should collect some data from MongoDB and put them to storage queue.</p>
  
  <p>I have added mongoDB dependencies to the to project.json and this is what the file looks like:</p>
  
  <pre><code>{
    "frameworks": {
      "net46":{
        "dependencies": {
          "MongoDB.Bson": "2.4.2",
          "MongoDB.Driver": "2.4.2",
          "MongoDB.Driver.Core": "2.4.2",
          "System.Runtime.InteropServices.RuntimeInformation": "4.0.0"
        }
      }
    }
  }
  </code></pre>
  
  <p>However when i call:</p>
  
  <pre><code>MongoClientSettings settings = MongoClientSettings.FromUrl(new MongoUrl(conn));
  settings.SslSettings = new SslSettings() { EnabledSslProtocols = SslProtocols.Tls12 };
  var client = new MongoClient(settings);
  </code></pre>
  
  <p>I get an error after the last line is called:</p>
  
  <pre><code>mscorlib: Exception has been thrown by the target of an invocation. MongoDB.Driver.Core: Could not load file or assembly 'System.Runtime.InteropServices.RuntimeInformation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
  </code></pre>
  
  <p>I've checked and .net version is 4.6 so there should be no problem with that. Is there anything else I am missing.</p>