在.NET Core项目中找不到System.ServiceModel [英] System.ServiceModel not found in .NET Core project

查看:2481
本文介绍了在.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的Framework 4.7项目一起使用.Http.4.3.0

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 是基本软件包;

这篇关于在.NET Core项目中找不到System.ServiceModel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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