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-
“Attempted to access an unloaded AppDomain”
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.
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 had 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:
Detailed Documentation at- http://msdn.microsoft.com/en-us/library/aa577833(v=bts.20).aspx
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