my coworkers and I have been stumped on this issue for several weeks. We have a PHP 5.3 web application hosted in an IIS 7 environment. The application fetches result sets from a SQL Server 2012 database backend and sends it as a JSON object back to the client.

The problem comes when a request is made that results in an object size that exceeds about 4MB. So each time a response exceeds this size, the connection gets reset and results in error. I've confirmed this on the local server by using Curl and this very useful [.JQ JSON command-line parser](http://stedolan.github.com/jq/). Using these tools, when I run a request on the IIS web server hosting the application it completes responses < 4MB successfully, but fails to complete responses > 4MB with the Curl(56) error *"Connection was reset"*.

Some additional notes: 

* the query running directly against the database only takes about 20 seconds to complete, so DB performance is not the issue.
* We run the Zend Framework on top of Apache in our local desktop dev environments; but this issue is not reproducible in any of them. The same > 4MB response object that fails on the web server, completes successfully when making the same request to our local Apache hosted environment.

I combed the web server's IIS 7 config settings and made the following changes

* I've increased max allowed content length and URL length to 30MB from their defaults.
* PHP, FastCGI and IIS connection timeout settings are set at 5-minutes each. I've run smaller queries that take up to a minute to complete, but a valid response always comes back as long as it's less than 4MB.

I started reading that IIS 7's response buffer cache mechanism may also affect PHP application performance, but I'm still getting familiar with this feature. If there's anyone who's had a similar issue in the past or could provide some insight into what the problem might be, I am open. At this point I'm not sure what else could be causing this issue on the IIS 7 web server.