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?
This question shows that the XmlSerializer, used by ASMX Web Services, by default Base64-encodes binary data , so yes, the overhead will be noticable.
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.