I came across an interesting problem today that turned out to have the simplest of solutions. We have a BizTalk Server app with two receive locations so trading partners can publish files to a file location or via a web service. Those receive locations implement a custom pipeline performing some preprocessing logic. Publishing messages to the file receive location using the file adapter works everytime. Publishing via the web service would see the pipeline fail with a type initializer error when trying to load custom framework assemblies.
The framework assemblies had been placed in the C:\Program Files\BizTalk Server 2006 and not in the GAC. The file receive handler runs in process with the btsntsvc process located in the C:\Program Files\BizTalk Server 2006 directory. So being in the same directory the receive handler was able to find the framework assemblies.
The SOAP receive handler runs under the isolated host meaning it runs outside the btsntsvc process. In the case of the SOAP adapter this process is litterally the W3WP process for the IIS app pool. Basically because those assemblies weren’t in the GAC the SOAP receive location couldn’t find the framework assmblies resulting in a type initializer error.