我有一个.NET Core xUnit项目。我想打电话给从中WCF服务,但出现以下情况例外:.NET Core项目中找不到System.ServiceModel
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.
它与一个框架4.7的项目有相同的NuGet包System.ServiceModel.Http.4.3.0
。
System.ServiceModel在.NET Standard和.NET Core中都被弃用。它已被ASP.NET Core取代。也许你必须重建你的WCF服务才能与.NET Core兼容。 – silkfire
@silkfire我担心。有没有记录在任何地方?我很疯狂,可以在不同的框架中安装相同的软件包并获得不同的功能。 – BanksySan
@silkfire如果这是答案,那就随意放下吧。 – BanksySan