// wcf 服务项目下 我创建的一个student类。想在客户端调用 里面的方法。
namespace WcfService3
{
[DataContract]
public class Student
{
private string _id;
private string _name;
private string _password; [DataMember]
public string id
{
get { return _id; }
set { _id = value; }
} [OperationContract] //是这样定义吗, public Student(string _id, string _name, string _password)
{
id = _id;
name = _name;
password = _password;
} [OperationContract] //是这样定义吗,客户端提示找不到这个方法 public string getID()
{
return id;
}
}//客户端调用
private void button3_Click(object sender, EventArgs e)
{
ServiceReference1.Service1Client serclient = new ServiceReference1.Service1Client();
ServiceReference1.Student aa = serclient.getStudent();
aa.getID(); //提示没有这个方法}
namespace WcfService3
{
[DataContract]
public class Student
{
private string _id;
private string _name;
private string _password; [DataMember]
public string id
{
get { return _id; }
set { _id = value; }
} [OperationContract] //是这样定义吗, public Student(string _id, string _name, string _password)
{
id = _id;
name = _name;
password = _password;
} [OperationContract] //是这样定义吗,客户端提示找不到这个方法 public string getID()
{
return id;
}
}//客户端调用
private void button3_Click(object sender, EventArgs e)
{
ServiceReference1.Service1Client serclient = new ServiceReference1.Service1Client();
ServiceReference1.Student aa = serclient.getStudent();
aa.getID(); //提示没有这个方法}
向导已经创建好了,很简单!
但是,现在我想自己再创建一个类Student,将发布出去