How to configure parameter / message length for WCF-RIA-Service

We send bitmaps from our Silverlight client to a server that will be saved using a specific WCF-RIA service. Our DomainService class looks something like this:

[EnableClientAccess()] public class CBitmapSavingService : DomainService { public void SaveBitmap(string bitmapGuid, byte[] pngBytes) { // Save PNG on server file system } } 

Works well until we get a large bitmap. Then we get the "DomainOperationException" exception.

I suspect that we have exceeded the size limit for a parameter or message.

Can I reconfigure my service so that larger bitmaps can be sent by the client using WCF-RIA-Services?

+1
source share
1 answer

I made the following change to the web.config file:

 <httpRuntime requestValidationMode="2.0" maxRequestLength="6225920"/> 

and it worked. (why 6225920? The size of the bitmap is 2048 * 760 before compression, I have to choose something)

I found the answer on another site: http://forums.silverlight.net/forums/p/186772/440463.aspx

This is intended only for a short-term fix for us, because we really do not want such large bitmaps on the server. I plan to change the client side so that the image type (PNG or JPEG) and quality are changed to create an image with a given maximum size.

+2
source

Source: https://habr.com/ru/post/1312594/


All Articles