Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Large binary over asmx web service

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?

like image 582
JJ_Jason Avatar asked Dec 07 '25 01:12

JJ_Jason


1 Answers

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.

like image 180
CodeCaster Avatar answered Dec 08 '25 15:12

CodeCaster



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!