在Azure函数中使用Gremlin.NET时无法加载文件或程序集'System.Reflection.TypeExtensions,Version = 4.0.0.0' [英] Could not load file or assembly 'System.Reflection.TypeExtensions, Version=4.0.0.0' when using Gremlin.NET in Azure Functions
问题描述
我想使用Gremlin.NET从Azure Functions更新Azure CosmosDB图.我正在使用1.0.10 Functions Cli,.NET Framework 4.7.1和具有以下依赖项的项目:
I want to update an Azure CosmosDB Graph from Azure Functions with Gremlin.NET. I'm using 1.0.10 Functions Cli, .NET Framework 4.7.1 and a project with these dependencies:
<PackageReference Include="Gremlin.Net" Version="3.3.2" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.DocumentDB" Version="1.2.0" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.DurableTask" Version="1.2.2-beta3" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.13" />
提交查询时
var gremlinServer = new GremlinServer(
Settings.GraphEndPoint,
443,
enableSsl: true,
username: "/dbs/" + Settings.GraphDatabaseName + "/colls/" + Settings.GraphName,
password: Settings.GraphPrimaryKey);
using (var gremlinClient = new GremlinClient(gremlinServer, new GraphSON2Reader(), new GraphSON2Writer(), GremlinClient.GraphSON2MimeType))
{
var resultSet = await gremlinClient.SubmitAsync<dynamic>(graphStatement);
我遇到此错误:
执行功能:GraphQuery时发生异常. Gremlin.Net:无法加载文件或程序集'System.Reflection.TypeExtensions,版本= 4.0.0.0,区域性=中性,PublicKeyToken = b03f5f7f11d50a3a'或其依赖项之一.系统找不到指定的文件.
Exception while executing function: GraphQuery. Gremlin.Net: Could not load file or assembly 'System.Reflection.TypeExtensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
NuGet依赖项依赖于System.Reflection.TypeExtensions版本4.3.0,文件版本似乎为4.1.1.0.
NuGet dependencies diplay System.Reflection.TypeExtensions Version 4.3.0, file version seems to be 4.1.1.0.
我该怎么做才能使其正常工作?
What can I do to make it work?
添加了观察:
当我克隆时,将Gremlin.NET csproj添加到我的解决方案中,并在解决方案中引用它,我会遇到相同的错误.但是,如果我将Gremlin.NET Target框架从.NET Standard 1.3
更改为.NET Standard 2.0
,则不会出现此错误.但是,随后与Gremlin服务器的通信在Connection.ReceiveAsync
中中断.
Observation added:
When I clone, add Gremlin.NET csproj to my solution and reference it within the solution, I get the same error. However if I change Gremlin.NET Target framework from .NET Standard 1.3
to .NET Standard 2.0
I do not get this error. However then the communication with the Gremlin server breaks in Connection.ReceiveAsync
.
推荐答案
使用Gremlin.NET将功能应用程序迁移到Azure Functions v2-在此不会发生引用问题.
Migrated Function App with Gremlin.NET to Azure Functions v2 - the referencing problem does not occur here.
这篇关于在Azure函数中使用Gremlin.NET时无法加载文件或程序集'System.Reflection.TypeExtensions,Version = 4.0.0.0'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!