【发布时间】:2018-01-25 22:43:27
【问题描述】:
我有一个最终执行这行代码的 Azure 函数:
cosmosClient = new DocumentClient(endpoint, key, mode, null);
这在我们使用的大型 Web 应用程序以及测试工具中都能完美运行。当我在 Azure 函数中调用调用它的代码时,会产生以下异常:
Exception while executing function: Functions.ColdStorageReset. mscorlib: Exception has been thrown by the target of an invocation. zzz.DataLayer: Method not found: 'Void Microsoft.Azure.Documents.Client.DocumentClient..ctor(System.Uri, System.String, Microsoft.Azure.Documents.Client.ConnectionPolicy, System.Nullable`1<Microsoft.Azure.Documents.ConsistencyLevel>, Newtonsoft.Json.JsonSerializerSettings)'.
2018-01-25T22:33:15.436
Microsoft.Azure.Documents.Client.dll 的版本在所有位置都是 1.15.1.1。我也试过这个:
cosmosClient = new DocumentClient(endpoint, key, mode);
这给了我同样的结果。
有什么想法吗?
【问题讨论】:
-
这是一个编译函数吗?您的
cosmosClient变量是如何定义的以及在哪里定义的? -
这是一个 csx。它在类级别定义为:private DocumentClient cosmosClient;
-
首先,我假设这是 v1 主机运行时上的预编译函数?您的项目引用了哪个版本的 NewtonSoft.Json?
-
NewtonSoft 版本为 10.0.0.0。
-
是的,所以...你不能那样做。 :( 我将在下面提供更清晰的答案。
标签: c# azure azure-cosmosdb azure-functions