在 .NET Core 项目中找不到 System.ServiceModel [英] System.ServiceModel not found in .NET Core project
本文介绍了在 .NET Core 项目中找不到 System.ServiceModel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个 .NET Core xUnit 项目.我正在尝试从中调用 WCF 服务,但出现以下异常:
I have a .NET Core xUnit project. I'm trying to call a WCF service from it but get the following exception:
System.InvalidOperationException occurred
HResult=0x80131509
Message=An error occurred while loading attribute 'ServiceContractAttribute' on type 'IMyContract'. Please see InnerException for more details.
Inner Exception 1:
FileNotFoundException: Could not load file or assembly 'System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified.
它适用于具有相同 Nuget 包 System.ServiceModel.Http.4.3.0
的 Framework 4.7 项目.
It works with a Framework 4.7 project with the same Nuget Package System.ServiceModel.Http.4.3.0
.
推荐答案
Microsoft 现已在 NuGet 上以包的形式提供相关程序集.
Microsoft has made available the relevant assemblies as packages on NuGet now.
System.ServiceModel.Primitives 是基础包;如有必要,将其他人添加到您的项目中.
System.ServiceModel.Primitives is the base package; add the others if necessary to your project.
这篇关于在 .NET Core 项目中找不到 System.ServiceModel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文