[英]Client memory usage on WCF web service with large data
I have a WCF web service which needs to returns a file (Can be returned by a byte array or by streaming). 我有一个WCF Web服务,它需要返回一个文件(可以通过字节数组或流式返回)。 I was first returning a byte[] in the interface, which caused the client to go up to a 400MB memory usage (at peak) for a 100MB file.
我首先在接口中返回一个byte [],这导致客户端为100MB的文件增加了400MB的内存使用量(峰值)。 Since I need to reduce the client memory usage, I've added another interface which streams the file back to the client.
由于我需要减少客户端的内存使用量,因此添加了另一个接口,该接口将文件流回客户端。 This time, I witness a 600MB increase in the client (again, in peak).
这次,我看到客户端增加了600MB (再次达到峰值)。 How can I reduce the client memory usage?
如何减少客户端内存使用量?
My current implementation of the server is as follows (streaming): 我当前对服务器的实现如下(流式处理):
[ServiceContract]
public interface IOmriService
{
[OperationContract]
Stream GetAudio(string input);
}
App.config: App.config:
<bindings>
<basicHttpBinding>
<binding name="HttpStreaming" maxReceivedMessageSize="67108864" transferMode="Streamed"/>
</basicHttpBinding>
</bindings>
As far as I know there is no way of doing it in WCF. 据我所知,在WCF中无法做到这一点。 What I did was using a "simple" http file download.
我所做的是使用“简单” http文件下载。 This consumes almost no memory by the client.
客户端几乎不占用任何内存。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.