WCF服务数据传输需要很长时间 [英] WCF Service Data Transfer taking long time

查看:76
本文介绍了WCF服务数据传输需要很长时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我已经创建了一个wcf服务,用于执行所有数据库调用并获取结果集。

我是使用MemoryStream从wcf服务中检索数据并将流写入文件。然后将文件流转换为数据集以获得结果。



这样做需要花费很多时间比正常执行时间。



我如何优化这个。



需要建议



谢谢

Ajit Kumar Nayak

解决方案

为什么不简单地创建datacontracts WCF端发送数据而不是使用流和文件操作?如果您可以直接使用这些数据合同来绑定到某些数据网格或某些列表视图等,而不是数据集,这应该按照我的理解工作....

例如。

 [DataContract] 
public class class Employee
{
[DataMember]
Name { get ; set ;}

[DataMember]
ID { get ; set ;}
}

[CollectionDataContract]
public class Employess:List< employee>
{
}

// WCF网络服务API
public Employees GetAllEmployees();
< / 员工 >


Hi,

I have created a wcf service for doing all the DB calls and to get the result set.
I am using MemoryStream to retrieve the data from wcf service and write the stream into a file.then converting the filestream to dataset for getting result.

Doing this is taking so much time than the normal execution time.

How can i optimize this.

Suggestions needed

Thanks
Ajit Kumar Nayak

解决方案

why don't you simply create datacontracts on WCF side to send the data instead of using stream and file operations? Also instead of datasets if you could consume those data contracts directly to bind to some datagrid or some listview etc that should work as per my understanding....
eg.

[ DataContract]
public class class Employee
{
      [DataMember]
      Name{get;set;}
       
       [DataMember]
       ID{get;set;} 
}

[CollectionDataContract]
public class Employess:List<employee>
{
}

//WCF web service API
public Employees GetAllEmployees();
</employee>


这篇关于WCF服务数据传输需要很长时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆