1,服务器端声明接口
//服务协定是描述服务需要实现的一系列接口,接口中定义需要实现的方法及对各个方法的属性描述
//定义服务协定
//ServiceContract是用来标注该接口是服务协定
[ServiceContract(Namespace = "http://VS2017.WCF.Sample")]
//服务接口
public interface IService
{
//加操作方法
[OperationContract]
double Add(double n1, double n2);
//减操作方法
[OperationContract]
double Subtract(double n1, double n2);
//乘操作方法
[OperationContract]
double Multiply(double n1, double n2);
//除操作方法
[OperationContract]
double Divide(double n1, double n2);
}
2,服务器端实现接口
//实现接口的方法
public class CalculatorService : IService
{
public d