无法加载 DLL“Microsoft.Azure.Documents.ServiceInterop.dll”[使用 Microsoft.Azure.DocumentDB 1.17.0]

usr*_*986 3 dll azure azure-cosmosdb

我在我的项目中使用 Microsoft.Azure.DocumentDB 1.17.0 并收到以下错误。“ServiceInterop.dll”Dll 存在于包含 Microsoft.Azure.DocumentDB dll 的文件夹中。但仍然低于错误

System.AggregateException: One or more errors occurred. ---> System.DllNotFoundException: Unable to load DLL 'Microsoft.Azure.Documents.ServiceInterop.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
   at Microsoft.Azure.Documents.ServiceInteropWrapper.CreateServiceProvider(String configJsonString, IntPtr& serviceProvider)
   at Microsoft.Azure.Documents.Query.QueryPartitionProvider.Initialize()
   at Microsoft.Azure.Documents.Query.QueryPartitionProvider.GetPartitionedQueryExecutionInfoInternal(SqlQuerySpec querySpec, PartitionKeyDefinition partitionKeyDefinition, Boolean requireFormattableOrderByQuery, Boolean isContinuationExpected)
    at Microsoft.Azure.Documents.Query.DocumentQueryExecutionContextBase.<GetPartitionedQueryExecutionInfoAsync>d__0.MoveNext()
 --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Microsoft.Azure.Documents.Query.DocumentQueryExecutionContextFactory.<CreateDocumentQueryExecutionContextAsync>d__5.MoveNext()
 --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.Documents.Linq.DocumentQuery`1.<CreateDocumentQueryExecutionContextAsync>d__12.MoveNext()
    --- End of inner exception stack trace ---
    at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
    at Microsoft.Azure.Documents.Linq.DocumentQuery`1.<GetEnumerator>d__b.MoveNext()
    at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
Run Code Online (Sandbox Code Playgroud)

ubi*_*bie 5

我遇到了同样的问题(尽管使用 Microsoft.Azure.DocumentDB.Core (1.7.1)。

\n\n

我通过安装 \n https://www.nuget.org/packages/Microsoft.Azure.DocumentDB/ nuget 包解决了这个问题。

\n\n
\n

PM> 安装包 Microsoft.Azure.DocumentDB -版本 1.19.1

\n
\n\n

现在在同一行上,我收到错误:\n消息:{“错误”:[“已使用针对非范围索引的路径的过滤器指定了无效查询。请考虑在请求中添加允许扫描标头。” ]}

\n\n

所以,感觉本质上我的查询在某种程度上是有问题的,但是在我安装框架 nuget (并且只有核心 nuget)之前,该库没有对错误做出优雅的响应。

\n\n

fwiw 我已经 grep 我的 /c (window 10 c 驱动器)和 /z (安装了我的源代码的数据驱动器) - 请参阅此处了解这些 dll 现在所在的位置。

\n\n

好的,现在修复实际的查询!

\n\n

另外,fwiw:\n根据此文档:\n https://learn.microsoft.com/en-us/azure/cosmos-db/sql-api-sdk-dotnet

\n\n
\n

1.11.0\n 修复了在将 Nuget 包与包含 project.json 的项目一起使用时,将 Microsoft.Azure.Documents.ServiceInterop.dll 和 DocumentDB.Spatial.Sql.dll 程序集自动 binplacing 到 application\xe2\x80\x99s bin 文件夹的问题工具。\n

\n\n

1.9.2\n 修复了缺少对 DocumentDB.Spatial.Sql.dll 和 Microsoft.Azure.Documents.ServiceInterop.dll 的引用,这些引用是在引用 Azure Cosmos DB 项目以及对 Azure Cosmos DB Nuget 包的引用时所需的。

\n
\n\n

这意味着这个问题在过去已经被修复了,也许在 .net 版本和/或 .net core 2.0 版本中已经回归了?

\n\n

[1]

\n\n
$ find /c -iname "*Microsoft.Azure.Documents.ServiceInterop.dll*"\n./Users/<myuser>/.nuget/packages/microsoft.azure.documentdb/1.19.1/runtimes/win7-x64/native/Microsoft.Azure.Documents.ServiceInterop.dll\n./Users/<myuser>/.nuget/packages/microsoft.azure.documentdb/1.6.1/build/native/Microsoft.Azure.Documents.ServiceInterop.dll\n./Users/<myuser>/.nuget/packages/microsoft.azure.documentdb.core/1.7.1/runtimes/win/native/Microsoft.Azure.Documents.ServiceInterop.dll\n./Users/<myuser>/AppData/Local/Azure.Functions.Cli/1.0.7/Microsoft.Azure.Documents.ServiceInterop.dll\n\n\n$ find /z -iname "*Microsoft.Azure.Documents.ServiceInterop.dll*"\n./Git/documentdb-dotnet-todo-app/packages/Microsoft.Azure.DocumentDB.1.6.1/build/native/Microsoft.Azure.Documents.ServiceInterop.dll\n./Git/documentdb-dotnet-todo-app/src/bin/Microsoft.Azure.Documents.ServiceInterop.dll\n./Git/ReturnAdB2cGroups/CalorieCruncher/bin/Debug/netstandard2.0/bin/runtimes/win/native/Microsoft.Azure.Documents.ServiceInterop.dll\n./Git/ReturnAdB2cGroups/CalorieCruncher/bin/Debug/netstandard2.0/bin/runtimes/win7-x64/native/Microsoft.Azure.Documents.ServiceInterop.dll\n./Git/ReturnAdB2cGroups/CalorieCruncher/bin/Debug/netstandard2.0/Microsoft.Azure.Documents.ServiceInterop.dll\n./Git/ReturnAdB2cGroups/packages/Microsoft.Azure.DocumentDB.1.6.1/build/native/Microsoft.Azure.Documents.ServiceInterop.dll\n./Git/ReturnAdB2cGroups/ReturnAdB2cGroups/bin/Debug/netstandard2.0/bin/runtimes/win/native/Microsoft.Azure.Documents.ServiceInterop.dll\n
Run Code Online (Sandbox Code Playgroud)\n