我正在使用WCF服务库,我返回列表。然后在MVC-4应用程序中创建服务引用。但是无法创建代理客户端对象。我也配置了服务引用并将Collection类型设置为System.Collections.Generic.List但仍然遇到问题。
Mu Code In Service Library是:
[ServiceContract]
public interface IStudent
{
// [WebGet(ResponseFormat = WebMessageFormat.Json)]
[OperationContract]
[WebInvoke(BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json)]
List<Studentdata> GetData();
}
[DataContract()]
public class Studentdata
{
[DataMember()]
public string StudentId { get; set; }
[DataMember()]
public string FirstName { get; set; }
[DataMember()]
public string LastName { get; set; }
[DataMember()]
public Nullable<int> Age { get; set; }
[DataMember()]
public string Gender { get; set; }
[DataMember()]
public string Batch { get; set; }
[DataMember()]
public string Address { get; set; }
[DataMember()]
public string Class { get; set; }
[DataMember()]
public string School { get; set; }
[DataMember()]
public string Domicile { get; set; }
}
StudentDataAccess obj = new StudentDataAccess();
public List<Studentdata> GetData()
{
var query = obj.getalldata().ToList();
List<Studentdata> obj1 = query.ToList().ConvertAll(new Converter<BtDataLayer.Student, Studentdata>(Converter.ConvertEntStudentToWcfStudent));
return obj1;
}
StudentDataAccess obj = new StudentDataAccess(); 是实体项目类对象
请帮帮我。提前谢谢。