Configuring a BizTalk WCF Inbound Service with BasicHttp for Large Messages
Exposing a BizTalk schema or orchestration as a WCF service is usually a pretty easy process, especially with the help of the BizTalk WCF Service Publishing Wizard. But when you expose BizTalk artifacts as basicHttp WCF services, you end up being able to use only the default reader quota settings for the protocol for items such as maxArrayLength (16384), maxBytesPerRead (4096), maxDepth (32), and maxStringContentLength (8192). This will present problems when dealing with larger messages.
One common error is:
The adapter "WCF-BasicHttp" raised an error message. Details "System.Xml.XmlException: The 'maximum bytes per Read operation' quota (4096) has been exceeded while reading XML data. Long element start tags (consisting of the element name, attribute names and attribute values) may trigger this quota. This quota may be increased by changing the MaxBytesPerRead property on the XmlDictionaryReaderQuotas object used when creating the XML reader
This problem, among others, is discussed here: http://technet.microsoft.com/en-us/library/bb246060(BTS.10).aspx
One work-around is to reconfigure the Receive Location in BizTalk to use the WCF-Custom adapter instead of WCF-BasicHttp. Remember that the adapter settings will override anything in the service’s .config file. The WCF-Custom adapter allows much more configuration than the WCF-BasicHttp adapter and will allow you to set all these readerQuota values to much higher levels needed to support larger messages.
If you’re interested in how to set up the WCF-Custom adapter to use Basic Http, just comment or email me and I’ll create a post to discuss how it is done.