【发布时间】:2016-05-02 16:05:13
【问题描述】:
嗨, 如何从 MVC Web api 调用 WCF 服务并将服务模型绑定到 MVC 模型中?你能帮忙吗??????
[DataContract]
public class Employee
{
[DataMember]
public int Id { get; set; }
[DataMember]
public string Name { get; set; }
[DataMember]
public int Age { get; set; }
}
这是员工类
EndpointAddress endpointAddress = new EndpointAddress(ConfigurationManager.AppSettings["ServiceKey"]);
string endpointConfigurationName = "SampleSerVice";
ClassProxy obj = new ClassProxy(endpointConfigurationName, endpointAddress);
var result = obj.GetEmployeeName();
result 返回员工列表,但是如何将其绑定到 MVC 模型
【问题讨论】:
标签: c# wcf model-view-controller asp.net-web-api .net-4.6