在ASMX Web服务的大型二进制 [英] Large binary over asmx web service

查看:327
本文介绍了在ASMX Web服务的大型二进制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我转流过经典的ASMX Web服务的大型压缩文本文件。
我这样做的理由是,该文件的大小为20 MB解压缩,压缩4MB



这是方法。我公司将提供必要时的附加信息。

  [的WebMethod] 
公众的byte []转让()
{
返回File.ReadAllBytes(@4MBFile.zip);
}



我使用C#和.NET 4。(我改变了最初的设置该项目从2.0到4.0)。



一个WebMethod用一种系列化的,所以我想会有一些开销。



我真能转移只有4MB?
我如何衡量这种开销,如果有任何?


解决方案

的XML Web服务通过标准Web协议暴露给网络用户有用的功能。在大多数情况下,所使用的协议是SOAP




这个问题表明XmlSerializer的,由ASMX Web服务使用,默认情况下使用Base64编码的二进制数据,所以是,开销将是noticable。




我真能转流只有4MB?




是什么让你使用的提琴手的?它会告诉确切的HTTP响应的车身尺寸。



似乎是一个解决方案通过归咎于财产hexBinary的,所以它不会是Base64编码的。


I am transfering a large zipped text file over the classic asmx web service. My reason for doing so is that the file's size is 20 MB unzipped, 4MB zipped.

This is the method. I will provide additional information if necessary.

    [WebMethod]
    public byte[] Transfer()
    {
        return File.ReadAllBytes(@"4MBFile.zip");
    }

I am using C# and .NET 4. (I changed the initial settings for the project from 2.0 to 4.0).

A webmethod uses a kind of serialization so I guess there will be some overhead.

Am i really transferring only 4MB? How do I measure this overhead, if there is any?

解决方案

XML Web Services expose useful functionality to Web users through a standard Web protocol. In most cases, the protocol used is SOAP.

This question shows that the XmlSerializer, used by ASMX Web Services, by default Base64-encodes binary data , so yes, the overhead will be noticable.

Am I really transfering only 4MB?

What keeps you from monitoring a service call using Fiddler? It'll tell the exact HTTP response body size.

There seems to be a solution by attributing the property as hexBinary, so it won't be Base64-encoded.

这篇关于在ASMX Web服务的大型二进制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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