In a recent project with a client we were configuring our messaging-only AS2 solution for moving data to and from their customers via AS2 (HTTP). We had successfully moved a few customers on to the BizTalk 2009 solution already but ran into a strange issue while testing another client.
During testing, we generally used smaller test messages that could be easily detected and thrown away so we did not pick up on this problem initially. My client stated noticing that when larger AS2 payloads were sent (by larger I mean maybe 1 kbyte and larger files so not big) we were getting HTTP connection errors. The error message was: "Unable to read data from the transport connection. The connection was closed.” It appeared the remote HTTP server was closing the connection sooner than BizTalk expected. Strangely enough, the payload seemed to go though most of the time anyway.
Originally, while researching this issue we came across many anecdotes about HTTP Keep Alives and how some Apache servers did not jive well with using that feature so we tried turning them off in our AS2 party configuration. Nothing changed, however. We investigated everything from firewall logs on both sides to considering sniffing the wire to see what the HTTP communication was doing.
In the end, nothing we tried fixed the issue so I went back to the basics, read through all the Microsoft documentation and AS2 walkthroughs when finally I saw something that caught my eye: "Enable Chunked Encoding" was explicitly disabled/unchecked on the HTTP send ports. There was no rationale as to why this was done so it very quickly fell through the cracks. As soon as we unchecked Enable Chunked Encoding on the send ports of this customer the problem went away and we’ve been sailing smooth ever since.