• WCF说明


    1,创建服务契约类 :用接口来实现服务契约

       1: using System.ServiceModel;
       2: namespace Artech.WcfServices.Contracts
       3: {
       4:     [ServiceContract(Name="CalculatorService", Namespace="http://www.artech.com/")]
       5:     public interface ICalculator
       6:     {
       7:         [OperationContract]
       8:         double Add(double x, double y);
       9:  
      10:         [OperationContract]
      11:         double Subtract(double x, double y);
      12:  
      13:         [OperationContract]
      14:         double Multiply(double x, double y);
      15:  
      16:         [OperationContract]
      17:         double Divide(double x, double y);        
      18:     } 
      19: }

    2,创建服务类:用服务类来实现服务契约接口类

       1: using Artech.WcfServices.Contracts;
       2: namespace Artech.WcfServices.Services
       3: {
       4:    public class CalculatorService:ICalculator
       5:     {
       6:         public double Add(double x, double y)
       7:         {
       8:             return x + y;
       9:         }
      10:  
      11:         public double Subtract(double x, double y)
      12:         {
      13:             return x - y;
      14:         }
      15:  
      16:         public double Multiply(double x, double y)
      17:         {
      18:             return x * y;
      19:         }
      20:  
      21:         public double Divide(double x, double y)
      22:         {
      23:             return x / y;
      24:         }
      25:     }
      26: }

    3:通过自我寄宿的方式寄宿服务:

  • 相关阅读:
    java DES转C#DES加密解密
    PIE SDK影像格式转换
    PIE SDK位深转换
    PIE SDK存储格式转换
    PIE SDK栅格生成等值线、面
    PIE SDK反距离权重插值算法
    PIE SDK克里金插值法
    PIE SDK热力图
    PIE SDK Alpha通道数据渲染
    PIE SDK 多数据源的复合数据集加载
  • 原文地址:https://www.cnblogs.com/netact/p/2093232.html
Copyright © 2020-2023  润新知