Payload size limitation in .Net

I currently work on the replacement of a fairly old ROSDK Sevice-application - written in Delphi, about 10 years ago. The new one is written in C# using the current ROSDK to provide TLS, Authentication and the HTTP API.
On testing I noticed, that I’m unable to call service-methods, when the whole payload is greater then 5 MB. The old Delphi version did’nt had this limitation.
In my old service version it was possoble to send ComplexTypes with binary members up to 20-30 MB (never tested more). I have to provide this functionality in .Net too, because 5MB are definitely not enough for out customers. Also I have to keep the method-signatures of the old RODL, because we have a lot of customers with Non-ROSDK client implementations.

Long question - short: Where can I turn off the 5MB Limit of the Messages, Channels or underlaying connections or change it to 20MB for example?

To start with, change the MaxMessageSize and MaxDecompressedMessageSize property values of the BinMessage used server-side.

IIRC you’re using the CodeFirst approach so the required code would look like

var message = new BinMessage();
message.MaxDecompressedMessageSize = Int32.MaxValue;
message.MaxMessageSize = Int32.MaxValue;
server.NetworkServer.RegisterServerMessage(message);

Some of the channels also have their own set of security options (as request size limitation purpose was to prevent server abuse):

  • for HttpSysChannel, IpTcpServerChannel and IpHttpServerChannel it is ..SecurityOptions.MaxRequestSize
  • for IpSuperHttpServerChannel it is MaxPackageSize

Unrelated: Remoting SDK for Delphi has the same set of size limitations. Most probably they are lifted in the Delphi app.

Thank you. Is working fine …

1 Like