当前位置:编程学习 > C#/ASP.NET >>

Win phone 下WCF问题

  最近在做win phone手机和服务器通信问题,想问下用WCF好吗?我们才开始接触WCF~

  另外,碰到了个问题,在win phone下添易做图务器引用服务后为什么在客户端编程的时候没有看到服务中的方法?
  代码如下:

  服务器上的服务契约:
  

   using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;

namespace Service
{
    [ServiceContract]
    public inte易做图ce IHello
    {
        [OperationContract]
        String  Hello(String s);
    }
    public class HelloWorld : IHello
    {
        public String  Hello(String s)
        {
            Console.WriteLine("Accept from client: " + s );
            String returnString = "Hello, you just input " + s;
            return returnString;
        }
    }

}


客户端上的代码:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using Client.ServiceReference1;

namespace Client
{
    public partial class MainPage : PhoneApplicationPage
    {
        // Constructor
        public MainPage()
        {
            InitializeComponent();
        }

        private void start_Click(object sender, RoutedEventArgs e)
        {
            string s1 = input.Text;
            string s2 = new HelloClient().Hello(s1);   //关键是这里没有Hello方法,然后就不知道怎么写了
        }
    }
}


有知道的帮忙看下,谢谢!!!!
补充:.NET技术 ,  Web Services
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,