首页 新闻 会员 周边

WCF客户端获取 服务器返回的ObservableCollection<Employee>类型 出错

1
悬赏园豆:5 [待解决问题]

An error occurred while receiving the HTTP response to http://localhost:8088/EmployeesService. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details.

我在使用WCF的时候 服务器端有个方法使用linq 查询返回ObservableCollection<Employee> 类型。

客户端在调用这个方法的时候就出现了如上的错误信息。

我在调试的时候发现,服务器端返回其他类型的方法都没有问题,只有返回这个ObservableCollection<Employee> 类型出错。

下面是我的代码:
客户端调用:
  using (EmployeesServiceClient proxy = new EmployeesServiceClient("BasicHttpBinding_IEmployeesService"))
  {
  //System.Windows.MessageBox.Show(proxy.test());
  AllEmployees=proxy.GetAllEmployees();
  proxy.Close();
  //RaisePropertyChanged("AllEmployees");
  }

Contract 类:
  public interface IEmployeesService
  {
  [OperationContract]
  ObservableCollection<Employees> GetAllEmployees();

  // TODO: Add your service operations here
  [OperationContract]
  string test();
  }

ContractService 类:
  public class EmployeesService : IEmployeesService
  {
  WPFBusiness.BEmployees be = new BEmployees();

  public ObservableCollection<Employees> GetAllEmployees()
  {
  return be.GetAllEmployees();
  }
  }
endpoint:
<endpoint address="" binding="basicHttpBinding" contract="WcfContract.IEmployeesService"/>

ChouKei的主页 ChouKei | 初学一级 | 园豆:183
提问于:2011-10-25 00:06
< >
分享
所有回答(1)
0

1.Employees类属性中是否有加[DataMember]契约?

2.服务引用中的配置是否将集合类型配置成了ObservableCollection类型?

.生.. | 园豆:205 (菜鸟二级) | 2011-10-25 11:19
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册