【发布时间】:2020-02-03 14:07:50
【问题描述】:
我在 Core 3.1 上本地运行 Azure 函数 v2。函数连接从 EventHub 读取事件并将数据写入 Redis 数据库。 连接函数出错时
System.Private.CoreLib: Exception while executing function:
One or more errors occurred. (Could not load file or assembly 'System.Memory, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.).
Pipelines.Sockets.Unofficial: Could not load file or assembly 'System.Memory, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified. System.Private.CoreLib: Could not load the specified file.
相同的 Redis 连接代码在 Azure 函数之外正常工作。
我已将 System.Memory nuget 包 v 4.5.3 安装到项目中,但它没有帮助。 Core 3.1 的 nuget 中没有列出 System.Memory 4.2 版
函数使用启动
[assembly: FunctionsStartup(typeof(...))]
项目文件
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AzureFunctionsVersion>v2</AzureFunctionsVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.0.0" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.EventHubs" Version="4.1.0" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.3" />
<PackageReference Include="System.ComponentModel.Annotations" Version="4.7.0" />
<PackageReference Include="System.Memory" Version="4.5.3" />
<PackageReference Include="Utf8Json" Version="1.3.7" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Configuration\Configuration.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="host.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="local.settings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
</ItemGroup>
</Project>
怎么了?
【问题讨论】:
标签: azure .net-core serverless