views:

19

answers:

1

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

  1. Must be a .NET webservice - with and without SSL
  2. Must have a binary encoding to cut the amount of data going over the internet
  3. 4MB is the upper bound for the data size
  4. Code settings are prefered to {web/app}.config - I like everything in one place

Questions

  1. 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?

  2. 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.

  3. 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

A: 

Based on your code you are using ASP.NET web service so you can't use MTOM, binary encoding or streaming.

For WCF service:

  1. Yes. MTOM can be used for BasicHttpBinding and binary encoding can be used for custom binding over HTTP transport. But binary encoding makes your service non interoperable. Only WCF clients will be able to call your service.
  2. Yes there is plenty of timeouts and all are well described on MSDN.
  3. It depends on number of concurrent requests you expect and the way how the message is processed. If you expect 100 concurrent requests you will have 400MB in your buffer. Again streaming is possible for BasicHttpBinding but it is not interoperable and it requires changing your operations.
Ladislav Mrnka