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.
It works with a Framework 4.7 project with the same Nuget Package System.ServiceModel.Http.4.3.0
.
ServiceModel. Select Project-> Add Reference and then select the assembly name. Thank you for your answer!
servicemodel element in the web. config file. Under the first level of the system. servicemodel element, there are behaviors, bindings and services.
BasicHttpBinding Class (System.ServiceModel) Represents a binding that a Windows Communication Foundation (WCF) service can use to configure and expose endpoints that are able to communicate with ASMX-based Web services and clients and other services that conform to the WS-I Basic Profile 1.1.
NET Core and . NET 5 support calling WCF services, but won't offer server-side support for hosting WCF. There are two recommended paths for modernizing WCF apps: gRPC is built on modern technologies and has emerged as the most popular choice across the developer community for RPC apps.
Microsoft has made available the relevant assemblies as packages on NuGet now.
System.ServiceModel.Primitives is the base package; add the others if necessary to your project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With