无法在Azure Function v2中加载文件或程序集'System.Private.ServiceModel' [英] Could not load file or assembly 'System.Private.ServiceModel' in Azure Function v2

查看:96
本文介绍了无法在Azure Function v2中加载文件或程序集'System.Private.ServiceModel'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了带有自定义dll(.net核心2.2)的v2 azure函数(持久函数),该函数调用服务,但出现以下异常:

I used a v2 azure function (durable function) with custom dll (.net core 2.2) that calls a service and I get the following exception:

无法加载文件或程序集'System.Private.ServiceModel, 版本= 4.1.2.4,文化=中性,PublicKeyToken = b03f5f7f11d50a3a'

Could not load file or assembly 'System.Private.ServiceModel, Version=4.1.2.4, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

在调试过程中,我无法进入该方法,并且在不让我进入该方法的情况下引发了异常,并且我不知道到底是什么试图访问该库. 将来自.nuget的程序包手动放入bin文件夹不起作用,奇怪的是,如果使用示例C#函数运行相同的代码,它将起作用.

In the debugging process, I can't step into the method and the exception is thrown without letting me inside it and I don't know exactly what tried to access that library. Putting manually the package from .nuget in the bin folder didn't work and the strange thing is that if a run the same code with a sample C# function it works.

推荐答案

此问题在此处详细说明: https://github.com/dotnet/wcf/issues/2824

This issue is detailed here: https://github.com/dotnet/wcf/issues/2824

我解决的方法是下载nuget System.Private.ServiceModel

How I solved it was to download the nuget System.Private.ServiceModel

并将以下内容添加到我的.csproj

and add the following to my .csproj

<Target Name="CopySPSM" BeforeTargets="Build">
<Copy SourceFiles="$(USERPROFILE)\.nuget\packages\system.private.servicemodel\4.5.3\runtimes\win\lib\netstandard2.0\System.Private.ServiceModel.dll" DestinationFolder="$(OutputPath)\bin" />
</Target>

这篇关于无法在Azure Function v2中加载文件或程序集'System.Private.ServiceModel'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆