最佳答案
我有一个。NET 核心 xUnit 项目。我尝试从它调用 WCF 服务,但是得到以下异常:
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 Package System.ServiceModel.Http.4.3.0
一起工作。