BizTalk Server 2009: Troubleshooting “Attempted to access an unloaded Appdomain”
Recently one of my customer using BizTalk Server 2009 faced this issue, where he had SOAP adapter to connect to a web service but got the below error-
Error
“Attempted to access an unloaded AppDomain”
Cause:
The SOAP adapter runs in the IIS process space. If more than one Web service exists in the IIS AppPool, then every Web service ends up having its own AppDomain.
By default, all messaging engine objects are created in the first AppDomain (i.e. the AppDomain corresponding to the first Web service).
If the first Web service is inactive for an extended period of time for any reason, IIS unloads the first AppDomain. When this happens, all services in the hosting process become unusable.
Resolution:
This issue can be successfully resolved in 2010 and above solution by enabling “Default application domain for isolated adapter” in Isolated hosts settings.
Detailed Documentation at- http://msdn.microsoft.com/en-us/library/aa577833.aspx
But before 2010 we did not have this setting in host properties. After some research we ended up making below registry changes: –
Set (or Add if it doesn’t exists) the following registry key to 1:
HKLM\System\CurrentControlSet\Services\BTSSvc.3.0\UseDefaultAppDomainForIsolatedAdapter
References
Detailed Documentation at- http://msdn.microsoft.com/en-us/library/aa577833(v=bts.20).aspx
Important
For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the below article. http://support.microsoft.com/kb/322756
See Also
Another important place to find a huge amount of BizTalk related articles is the TechNet Wiki itself. The best entry point is BizTalk Server Resources on the TechNet Wiki.