通过WCF

时间:2018-10-11 17:54:19

标签: c# entity-framework wcf datagridview

我试图通过WCF传输从EF查询(在服务器端)生成的BindingSource,以在DataGridview中(在客户端上)显示该BindingSource。但是,我无法完成这项工作,我也不明白为什么。

服务器端:EF查询

public BindingSource GetDataTable(string name)
    {
        BindingSource bs = new BindingSource();

        try
        {
            IEnumerable<ExtendedTable> query = from process in Context.ProcessEntity
                        where process.Name == name
                        join model in Context.ModelEntity on process.ModelId equals model.ModelId
                        select new ExtendedTable
                        {
                            Timestamp = process.Timestamp,
                            Name = process.Name
                            Model = model.ModelId
                            Result = model.Result
                        };

            bs.DataSource = query.ToList();
        }
        catch(EntityException ex)
        {
            throw new ConnectionFailedException(ex);
        }
        return bs;
    }

客户端:通过WCF和展示广告致电

bindingSourceDataTable.DataSource = typeof(ExtendedTable);
bindingSourceDataTable = pipeProxy.GetDataTable(name);
dataGridViewMain.DataSource = bindingSourceDataTable.DataSource;

此行发生错误:

bindingSourceDataTable = pipeProxy.GetDataTable(name);

我的WCF服务似乎崩溃了:

  

System.ServiceModel.CommunicationObjectFaultedException:'通信对象System.ServiceModel.Channels.ServiceChannel由于处于故障状态,因此无法用于通信。'

任何帮助,建议或建议,将不胜感激!

谢谢

0 个答案:

没有答案