无法在Azure Function v2中加载文件或程序集'System.Private.ServiceModel'

编程入门 行业动态 更新时间:2024-10-08 22:56:51
本文介绍了无法在Azure Function v2中加载文件或程序集'System.Private.ServiceModel'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

I used a v2 azure function (durable function) with custom dll ( 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.

推荐答案

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

This issue is detailed here: github/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'

本文发布于:2023-11-13 11:22:21,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1584226.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:加载   文件   程序   Function   Azure

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!