<tfoot id='MSfts'></tfoot>

    • <bdo id='MSfts'></bdo><ul id='MSfts'></ul>
  1. <small id='MSfts'></small><noframes id='MSfts'>

    <i id='MSfts'><tr id='MSfts'><dt id='MSfts'><q id='MSfts'><span id='MSfts'><b id='MSfts'><form id='MSfts'><ins id='MSfts'></ins><ul id='MSfts'></ul><sub id='MSfts'></sub></form><legend id='MSfts'></legend><bdo id='MSfts'><pre id='MSfts'><center id='MSfts'></center></pre></bdo></b><th id='MSfts'></th></span></q></dt></tr></i><div id='MSfts'><tfoot id='MSfts'></tfoot><dl id='MSfts'><fieldset id='MSfts'></fieldset></dl></div>
    1. <legend id='MSfts'><style id='MSfts'><dir id='MSfts'><q id='MSfts'></q></dir></style></legend>

      从 azure 函数连接到 MongoDB

      时间:2023-10-05
      • <bdo id='XjkR9'></bdo><ul id='XjkR9'></ul>
          <tbody id='XjkR9'></tbody>
      • <small id='XjkR9'></small><noframes id='XjkR9'>

        <i id='XjkR9'><tr id='XjkR9'><dt id='XjkR9'><q id='XjkR9'><span id='XjkR9'><b id='XjkR9'><form id='XjkR9'><ins id='XjkR9'></ins><ul id='XjkR9'></ul><sub id='XjkR9'></sub></form><legend id='XjkR9'></legend><bdo id='XjkR9'><pre id='XjkR9'><center id='XjkR9'></center></pre></bdo></b><th id='XjkR9'></th></span></q></dt></tr></i><div id='XjkR9'><tfoot id='XjkR9'></tfoot><dl id='XjkR9'><fieldset id='XjkR9'></fieldset></dl></div>
        <tfoot id='XjkR9'></tfoot>

                <legend id='XjkR9'><style id='XjkR9'><dir id='XjkR9'><q id='XjkR9'></q></dir></style></legend>

                本文介绍了从 azure 函数连接到 MongoDB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我在从运行在 microsoft azure 上的 C# 函数连接到 MongoDB 时遇到问题.该函数是时间触发的,它应该从MongoDB收集一些数据并将它们放入存储队列.

                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.

                我已将 mongoDB 依赖项添加到 to project.json,文件如下所示:

                I have added mongoDB dependencies to the to project.json and this is what the file looks like:

                {
                  "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"
                      }
                    }
                  }
                }
                

                但是当我打电话时:

                MongoClientSettings settings = MongoClientSettings.FromUrl(new MongoUrl(conn));
                settings.SslSettings = new SslSettings() { EnabledSslProtocols = SslProtocols.Tls12 };
                var client = new MongoClient(settings);
                

                调用最后一行后出现错误:

                I get an error after the last line is called:

                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.
                

                我检查过,.net 版本是 4.6,所以应该没有问题.我还有什么遗漏的吗?

                I've checked and .net version is 4.6 so there should be no problem with that. Is there anything else I am missing.

                推荐答案

                我一直在挖掘他们的 JIRA 问题,发现 JIRA 问题.我已将 MongoDB.Driver MongoDB.Driver.CoreMongoDB.Bson 恢复到 2.3.0 版本,它工作得很好调整手表,所以这似乎是 Mongo 包本身的问题.

                I've been digging a bit through their JIRA issues and found JIRA ISSUE. I've reverted the MongoDB.Driver MongoDB.Driver.Core and MongoDB.Bson to a version 2.3.0 and it work like a fine tuned watch, so it seems to be the problem with the Mongo package itself.

                我已经用不同版本的包对其进行了测试,这个问题是在 2.4.0 版本中引入的.所有以前的版本都运行良好.

                I've tested it with the different versions of the package and the issue is introduced in the version 2.4.0. All the previous versions work well.

                这篇关于从 azure 函数连接到 MongoDB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:函数监听器无法启动.Azure 函数应用时间触发器 下一篇:FunctionsStartup vs IWebJobsStartup,在请求中读取 HttpHeaders 时出现问题

                相关文章

                    <i id='lAm8b'><tr id='lAm8b'><dt id='lAm8b'><q id='lAm8b'><span id='lAm8b'><b id='lAm8b'><form id='lAm8b'><ins id='lAm8b'></ins><ul id='lAm8b'></ul><sub id='lAm8b'></sub></form><legend id='lAm8b'></legend><bdo id='lAm8b'><pre id='lAm8b'><center id='lAm8b'></center></pre></bdo></b><th id='lAm8b'></th></span></q></dt></tr></i><div id='lAm8b'><tfoot id='lAm8b'></tfoot><dl id='lAm8b'><fieldset id='lAm8b'></fieldset></dl></div>

                  1. <small id='lAm8b'></small><noframes id='lAm8b'>

                    <legend id='lAm8b'><style id='lAm8b'><dir id='lAm8b'><q id='lAm8b'></q></dir></style></legend>
                    <tfoot id='lAm8b'></tfoot>

                      <bdo id='lAm8b'></bdo><ul id='lAm8b'></ul>