How to configure Parameter/Message length for WCF-RIA-Service operation

a 夏天 提交于 2019-12-06 16:09:18

问题


We send bitmaps from our Silverlight client to the server to be saved, using a WCF-RIA defined service operation. Our DomainService class looks a little like this:

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

Works fine, until we get a large bitmap. Then we get a 'DomainOperationException' exception.

I suspect that we are surpassing a size limit for either the parameter or the message.

Can I reconfigure my service such that larger bitmaps can be sent from the client with WCF-RIA-Services?


回答1:


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

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

and it worked. (why 6225920? Size of 2048*760 bitmap before compression, I gotta choose something)

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

This is only intended as a short term fix for us, because we don't really want such large bitmaps on the server. I plan to make a client side change, such that the picture type (PNG or JPEG) and quality will be changed to create an image within a defined maximum size.



来源:https://stackoverflow.com/questions/5470593/how-to-configure-parameter-message-length-for-wcf-ria-service-operation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!