WCF服务如何可以返回大量的数据? [英] How can a WCF service return large amounts of data?

查看:561
本文介绍了WCF服务如何可以返回大量的数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作是将数据传送给定制的客户端应用程序的Web应用程序。

I'm working on a web app that passes data to a custom client app.

我得到异常当数据超过了一些小的尺寸。由于最终用户很可能会使用越来越大的数据大小,我切换从WCF函数的返回是数据组的ID。

I'm getting exceptions when the data is over some "small" size. Since the end users will likely be using increasingly larger data sizes, I switched the return from the WCF function to be the ID of the data set.

接着,我转换客户端使用该ID来检索一些简单ASPX页面的数据。这工作得很好,但指在界面不一致。

Next, I converted the client to use the ID to retrieve the data from some simple ASPX page. This works fine, but means an inconsistency in the interface.


  1. 编辑:我不知道我怎么错过了返回一个流,但我确实的任何人都不会有超过WCF与流的问题?

  1. I'm not sure how I missed returning a Stream, but I did. Does anyone have problems with Streams over WCF?

除了一个连接断开,是否有通过HTTP读取文件的任何问题溪水从ASPX页面?

Other than a dropped connection, are there any issues in reading files via HTTP streams from an ASPX page?

我想$我失踪WCF的能力(如OOB数据)p $ psume。但随后,C#/。NET在线我的机器上已安装的帮助或者是pretty差或其他严重损坏。

I would presume that I'm missing a capability of WCF (like oob data). But then, the C#/.NET on-line help is either pretty poor or else seriously broken as installed on my machine.

感谢。

顺便说一句,在我的情况下,大量的数据是用户输入驱动,但将需要至少20MiB。

By the way, in my case the "large amount of data" is user-input driven, but will need to be at least 20MiB.

推荐答案

据我了解的大数据和流文章@Eugene提到,
必须切换传输模式,所有的通信,这意味着它会关闭一些完整性检查。

As I understand the Large Data and Streaming article mentioned by @Eugene, one must switch transport mode for all communication, meaning it turns off some integrity checks.

因此​​,我结束了使用半定制的HTTP客户端类,其中:

Consequently, I ended up with using a semi-custom HTTP client class where:


  • 下载使用ASPX页面(s)表示返回的数据并将其传输到了
    客户端应用程序的磁盘文件,

  • 上传将文件发送到生成一个GUID并保存一个ASPX页面
    文件到服务器与磁盘GUID作为其名称的一部分。然后,它
    调用一个WCF方法传递代替与GUID其他参数
    文件数据。

  • Downloads use ASPX page(s) that return the data and stream it to the client app's disk file,
  • Uploads send the file to an ASPX page that generates a GUID and saves the file to the server's disk with that GUID as part of its name. It then calls a WCF method to pass the other parameters with the GUID in lieu of the file data.

这是不漂亮,但它的工作原理。不幸的是,IIS或客户端应用程序可能崩溃
离开服务器硬盘上的临时文件,但他们本地化和可能
在服务创建清理。

It isn't beautiful but it works. Unfortunately, an IIS or client app crash could leave the temp files on the server hard drive, but they're localized and could be cleaned up on service creation.

这篇关于WCF服务如何可以返回大量的数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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