【发布时间】:2019-10-24 08:55:38
【问题描述】:
我尝试实现一个 azure 函数,但不断收到以下异常。
"TypeLoadException: Could not load type 'System.UriTemplate' from assembly 'System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
似乎还有一些其他人得到了相同的例外。 https://github.com/Azure/azure-functions-host/issues/3568
我已经使用 .NETCore 3.0 和带有 v2.0 的 AzureFunctions 实现了我的解决方案,并使用了 WindowsAzure.ServiceBus v6.0.0、System.private.ServiceModel 4.6.0 和 System.ServiceModel.Primitives 4.6.0。 据我所知,版本应该没有问题,但目前我不确定。
在链接中有很多解决方法,我已经尝试过但没有结果。在所有这些中,我都更改了文件结构以匹配我的。 (我知道其中一些适用于其他类型的项目等等,但仍然值得一试)。
<Target Name="FixForDotnetWcfIssueBuild" BeforeTargets="PostBuildEvent"> <Copy SourceFiles="$(OutputPath)bin\runtimes\win\lib\netstandard2.0\System.Private.ServiceModel.dll" DestinationFolder="$(OutputPath)bin" /> </Target>
<Target Name="FixForDotnetWcfIssuePublish" AfterTargets="AfterPublish"> <Copy SourceFiles="$(PublishDir)bin\runtimes\win\lib\netstandard2.0\System.Private.ServiceModel.dll" DestinationFolder="$(PublishDir)bin" /> </Target>
所以在我看来,WindowsAzure.ServiceBus 6.0.0 似乎与 .NETCoreApp v3.0 不兼容。
希望有人知道我不知道的事情并且愿意提供帮助,并且我已经告诉了足够多的人来解决这个难题。
【问题讨论】:
-
可以显示包的配置吗?
标签: c# azure .net-core azure-functions .net-framework-version