WCF - How to Increase Message Size Quota

Someone asked on Stack Overflow:

I have a WCF Service which returns 1000 records from database to the client. I have an ASP.NET WCF client (I have added service reference in asp.net web application project to consume WCF).

I get the following message when I run the client application:

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.

Any help? How to increase message size quota?

I posted the following answer, which was chosen as the accepted answer and received 650 upvotes:

You’ll want something like this to increase the message size quotas, in the App.config or Web.config file:

<bindings>
    <basicHttpBinding>
        <binding name="basicHttp" allowCookies="true"
                 maxReceivedMessageSize="20000000" 
                 maxBufferSize="20000000"
                 maxBufferPoolSize="20000000">
            <readerQuotas maxDepth="32" 
                 maxArrayLength="200000000"
                 maxStringContentLength="200000000"/>
        </binding>
    </basicHttpBinding>
</bindings>

And use the binding name in your endpoint configuration e.g.

...
bindingConfiguration="basicHttp"
...

The justification for the values is simple, they are sufficiently large to accommodate most messages. You can tune that number to fit your needs. The low default value is basically there to prevent DOS type attacks. Making it 20000000 would allow for a distributed DOS attack to be effective, the default size of 64k would require a very large number of clients to overpower most servers these days.

Notable comments

Nate (0 upvotes): @R.Anandan This is something configured on the server, if you are consuming the service its not something you will be able to change.

Nate (5 upvotes): @Slauma It would need to be changed on the server if that incoming parameter was too large; otherwise (and more likely) the change needs to be made in the client configuration file, since it is the response of the service (not its parameter) that is too large.

Nate (0 upvotes): @Joshua I’m afraid I don’t understand your question. Could you elaborate a little on what you’re trying to do and what isn’t working? Possibly open a new question and link it here?

Nate (0 upvotes): @NeilBarnwell This is a configuration option on both the client and the server.

proudgeekdad (19 upvotes): For others who are interested, I read on another blog that the maximum size is 2147483647. 20000000 is a bit smaller than this number, so using the smallest number you can get away with without interrupting service makes sense.

Nate (9 upvotes): Its sufficently large to accomidate most messages. You can tune that number to fit your needs. It is basically there to prevent DOS type attacks. Making it 20000000 would allow for a distributed DOS attack to be effective, the default size of 64k would require a very large number of clients to overpower most servers these day.s

Brian Vander Plaats (4 upvotes): Any particular reason for the message size of 20000000?

Nate (8 upvotes): You may also need to change it on the server – in the event you need to send in a large dataset as a parameter to a WCF Method.

bugBurger (22 upvotes): Thanks..This change is needs to be made in web.config file of client application.


Originally posted on Stack Overflow — 650 upvotes (accepted answer). Licensed under CC BY-SA.

Detect network connectivity from a WPF/XBAP Application?

Someone asked on Stack Overflow:

Is there any way to determine if an XBAP (WPF hosted in a browser) application has network connectivity? If not, how would a traditional windows client written in C# and .NET determine if it has connectivity?

Basically the use case is an XBAP application running on a mobile laptop connected to an intranet via WiFi. The laptop will not have a connection to the Internet. The WiFi connection may or may not be there depending upon where the user is at the time.

I posted the following answer, which was chosen as the accepted answer and received 4 upvotes:

GateWayIPAddressInformation should work: http://msdn.microsoft.com/en-us/library/system.net.networkinformation.gatewayipaddressinformation(loband).aspx

If you get the gateway IP address, and you can Ping (http://msdn.microsoft.com/en-us/library/system.net.networkinformation.ping(loband).aspx) it you are probably connected.


Originally posted on Stack Overflow — 4 upvotes (accepted answer). Licensed under CC BY-SA.

Post and Get via CURL

Someone asked on Stack Overflow:

I’m trying to send information from a form and a hidden email variable (from a db) to a PHP script using cURL. I have the post items moving correctly, but I am not sure if can also send a variable vai the url. (the $_Get)

I posted the following answer, which was chosen as the accepted answer and received 1 upvote:

A standard querystring should work.


Originally posted on Stack Overflow — 1 upvotes (accepted answer). Licensed under CC BY-SA.

IIS Server Name Change

Someone asked on Stack Overflow:

I have a certificate for that is valid for *.MyCompany.com. That is fine for my dev and test servers because the first part of the URLs for those computers ends like that.

I want to test this on my computer and the certificate is incorrect because my computer defaults to the url MyComputer.MyCompany.net.

Is there a way to fake out IIS in to thinking that my computer is .MyCompany.com or am I out of luck when it comes to testing this?

Thanks, Vaccano

I posted the following answer, which was chosen as the accepted answer and received 2 upvotes:

You should be able to edit the host header values for the IIS website to accept *.Mycompany.com. To get the DNS to resolve and work correctly, you may need to add an entry to your windows hosts file – mycomputer.mycompany.com 127.0.0.1. that will let you test locally.

Another option would be to use a self-signed cert for local development.


Originally posted on Stack Overflow — 2 upvotes (accepted answer). Licensed under CC BY-SA.

Is Adobe AIR a good engine as GUI to develop Windows application

Someone asked on Stack Overflow:

I want to develop a photo browser application in Windows platfrom, the UI should be very cool and has 3D effects,Adobe AIR is a good engine as GUI, but I don’t know how to integrate my C and C++ engines which I worte before into Adobe AIR, it seems the engine can’t hold ActiveX? What can I do? Thanks.

I posted the following answer, which was chosen as the accepted answer and received 4 upvotes:

If you are windows only, something like WPF is probably a better option, since you will be able to leverge any old C/C++ libraries you have throuhg PInvoke.

Air is best suited to using data with web services.

Notable comments

Nate (1 upvotes): I have never had issues with the performance of WPF. I’ve run WPF apps on tricked out gaming rigs and netbooks and never had major issues.


Originally posted on Stack Overflow — 4 upvotes (accepted answer). Licensed under CC BY-SA.

signed letter b

Dad. Geek.Gamer.Software developer.Cloud user.Old Car enthusiast. Blogger.


Top Posts


profile for Nate on Stack Exchange, a network of free, community-driven Q&A sites
a proud member of the blue team of 512KB club
Thoughts, opinions, and ideas shared here are my own. © 2026 Nate Bross.