I've read numerous posts about this and have received conflicting info - I'm trying to 'boil down' a number of questions others have asked in hopes a good clear answer can exist somewhere on the web :-)
I am writing .NET application for my PC that connects to an IIS webserver running ASP.NET. The webserver has two methods similar to:
[WebMethod]
public byte [] GetFile(string file)
{
// simplified
return File.ReadAllBytes(file);
}
[WebMethod]
public void PutFile(string file, byte [] data)
{
// simplified
return File.WriteAllBytes(file, data);
}
On the client, I'd want to call GetFile/PutFile using buffers that are about 4MB in size.
BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.None);
binding.AllowCookies = true;
binding.OpenTimeout = ???;
binding.MaxBufferSize = ???;
binding.MaxReceivedMessageSize = ???;
onlineTransport = new RemoteObject.RemoteObjectSoapClient(binding, new EndpointAddress(BaseUrl + "/page.asmx"));
// Read a file
byte [] foo = onlineTransport.GetFile("foo.file");
// Write a file
onlineTransport.PutFile("bar.file", foo);
Requirements
- Must be a .NET webservice - with and without SSL
- Must have a binary encoding to cut the amount of data going over the internet
- 4MB is the upper bound for the data size
- Code settings are prefered to {web/app}.config - I like everything in one place
Questions
ENCODINGS: I will be sending lots of these and the number of bytes sent over the wire is important - is it possible to use a binary message encoding, or a MTOM encoding while using a webservice over HTTP?
SETTINGS: When I transmit there are a number of max request & timeout values that are encountered. I'd like to understand what I'm doing and how to set them in code (not .config files). What would be GREAT is a layer model (jpeg) that shows where each of the timeouts and max values apply. For example, sending a big array over SOAP is different than the max message size.
STREAMING/BUFFERING: If the binary blobs are <4MB in size is streaming needed? the data is easily read/written from the filesystem, no data is generated on the fly. If the memory hit is just the 4MB I'm more than happy, I'm concerned that 4MB may balloon after various bufferings happen? - I'd like to better understand whats going on
some research material: http://msdn.microsoft.com/en-us/library/ms733742.aspx