WCF的接口怎么正确使用?

在Iservice类里

C# code?
1
2
3
4
5
6
7
8
9
10
11
12
13
  [ServiceContract]
    public interface IService1
    {
        [OperationContract]
        string GetData(int value);//系统自带的一个方法
  
        [OperationContract]
        CompositeType GetDataUsingDataContract(CompositeType composite);
  
        [OperationContract]
        string SayHello();//自己加的接口方法
        // TODO: 在此添加您的服务操作
    }


实现接口类service

C# code?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
 public class Service1 : IService1
    {
          
  
        public string SayHello()
        {
            return "Hello WCF";
        }
  
          
        public string GetData(int value)
        {
            return string.Format("You entered: {0}", value);
        }



在用的时候是


为什么系统定义的GetData有GetDataCompleted完成返回属性
而我的SayHello没有SayHelloCompleted?
要怎么用?

posted @ 2013-05-20 19:35  月夜风2012  阅读(286)  评论(0编辑  收藏  举报
合肥办公家具 数控模具