I am getting the following error:
The maximum message size quota for incoming messages (65536) has been exceeded.
To increase the quota, use the MaxReceivedMessageSize property on
the appropriate binding element.
- I am using WebhttpBinding which uses REST service.
- There is no configuration setting from client side.
- I am using MVC3 application.
Need help in stream more than 65536 bytes.
Is there any way to edit the ServiceHostFactory behaviour so that somewhere I can set MaxReceivedMessageSize property to 2GB
thanks for your response.
Since I am using WebHttpBinding,I would like to know how to override the ServiceHostFactory .
Creating a custom class and overriding the OnOpening() method of WebServiceHost can resolve the problem or not?
MaxReceivedMessageSizeis a property of the binding element; if you need to change it from the defaults you have two options:bindingelement.To do this on the client side, without a configuration file, you’ll need to bypass the normal service reference code and create the client channel yourself. You can see an example of how to do this on my blog post about using WCF without the auto-generated client proxy: Proxy-Free WCF. In essence, you do something like this in code:
If you need to change the behavior on the service side, you can specify a binding by calling
AddServiceEndpointon the service host class, for example:Also, I think that you could accomplish this by overriding the
OnOpeningmethod of a custom web service host, as per your question. Be aware that the baseOnOpeningbehavior potentially creates endpoints and edits binding behavior, so you will want to let it do all of that first, before you try to change the binding configurations yourself. But I’m not really sure why you would go to all that trouble…