Isolated AppDomain

May 5, 2009 at 7:57 PM
I am playing around with the UseIsolatedAppDomain setting and I cannot figure out how to adjust the behavior.  When I deploy, I can see the new Configuration section added in my BTSNTSvc.config containing all of the previously "invisible" defaults that BizTalk was using.  However, I do NOT see that there is a section added that is specific to my App.
I would expect to see some assembly reference to my specific assemblies, correct?

this is all I see.  Please advise - am I missing something?

<Configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Debugging StartupInDebugger="false" ValidateAssemblies="false" ValidateSchemas="false" ValidateCorrelations="false" DumpStreamOnError="false" EagerGC="false" ExtendedLogging="false" DumpParts="false" DumpStates="false" RetailAsserts="false" SupressKeepAlive="false" TestExtensions="false" />
  <Dehydration AlwaysDehydrate="false" NeverDehydrate="false" MinThreshold="1" MaxThreshold="1800" ConstantThreshold="-1">
    <PhysicalMemoryThrottlingCriteria OptimalUsage="90" MaximalUsage="95" IsActive="false" />
    <VirtualMemoryThrottlingCriteria OptimalUsage="900" MaximalUsage="1300" IsActive="true" />
    <PrivateMemoryThrottlingCriteria OptimalUsage="50" MaximalUsage="350" IsActive="true" />
  </Dehydration>
  <AppDomains AssembliesPerDomain="10" WeakXsdPartValidation="false" SuspendUponIncompleteResponse="Off">
    <DefaultSpec SecondsIdleBeforeShutdown="43200" SecondsEmptyBeforeShutdown="43800">
      <BaseSetup>
        <DisallowPublisherPolicy>false</DisallowPublisherPolicy>
        <DisallowBindingRedirects>false</DisallowBindingRedirects>
        <DisallowCodeDownload>false</DisallowCodeDownload>
        <DisallowApplicationBaseProbing>false</DisallowApplicationBaseProbing>
        <LoaderOptimization>NotSpecified</LoaderOptimization>
        <SandboxInterop>false</SandboxInterop>
      </BaseSetup>
    </DefaultSpec>
    <AppDomainSpecs />
    <ExactAssignmentRules />
    <PatternAssignmentRules />
  </AppDomains>
  <Throttling PauseAt="0" ResumeAt="0" />
</Configuration>
May 5, 2009 at 8:07 PM
Digging in more - I see that this is in the BiztalkDeploymentFramework.targets file:

 <ItemGroup>
    <AllPatternAssignmentRule Include="*">
      <AssemblyNamePattern>$(ProjectName).*</AssemblyNamePattern>
    </AllPatternAssignmentRule>
  </ItemGroup>

  <Target Name="DeployBtsNtSvcExeConfig" Condition="'$(UseIsolatedAppDomain)' == 'true'">
    <UpdateBizTalkAppDomainConfig AppDomainName="$(BizTalkAppName)" PatternAssignmentRules="@(AllPatternAssignmentRule)" />
  </Target>

this indicates to me that I should expect to see my specific project referenced in the <PatternAssignmentRules /> section of my biztalk config.

FYI - this is one of the latest betas of the BTDF.

** Is the framework code broken in this area or am I still missing something?

thanks!

Coordinator
May 5, 2009 at 9:47 PM
Yes, you should see a new AppDomain section defined for your application after a successful deployment.  When you undeploy the configuration is removed.  Are you sure you're getting through a full deployment with no errors?  I am pretty confident that this functionality is OK -- you'll see that it is enabled in the BizTalkSample btdfproj.  You could try building and deploying the BizTalkSample and see what that gives you.

Thanks,
Tom
May 6, 2009 at 1:31 PM
Here is what I discovered.  This functionality IS working on my local (standalone) box and on our shared development environment - but not on our identical QA systems.  Here is where I think the problem may lie - we have had issues with deploying completely to the QA environment, but we did not think they were related to this AppDomain issue, because we DO see the config file get modified, so we thought that step had been passed by the time our problem hit.  Let me lay out the sequence of events to see if you can make sense of it:

During the deployment, the process hangs during the DeployAndStartPorts target - just after the import:

...
    BTSTask.exe ImportBindings -Source:"C:\Program Files\MyApp\2.0\Deployment\PortBindings.xml" -ApplicationName:MyApp_2.0
    Microsoft (R) BizTalk Application Deployment Utility Version 3.6.1404.0
    Copyright (c) 2006 Microsoft Corporation. All rights reserved.
    
    Information: Importing bindings "C:\Program Files\MyApp\2.0\Deployment\PortBindings.xml" into application "MyApp_2.0" in BizTalk configuration database (server="xxxx", database="yyyyyy")...
    Information: Imported application "MyApp_2.0" bindings.
    
    Command succeeded with 0 errors, 0 warnings.

I logged this as a problem about a year ago and never really resolved it.  We've just gotten used to hitting control-C to get control of the hung process,
"^CTerminate batch job (Y/N)?"
and select "N" to let it continue.  The job finishes and all we have to do is start up the app manually in the admin console.  There are never any errors reported in the console, in the generated log, the event log, nor are there any warnings when we start up manually.

Is the piece that writes the actual AppDomain values getting hosed by this?

Chris
May 6, 2009 at 1:58 PM
Just answered my own question - I compared the logfile from the successful (non-hanging) deployment and the failing one.  The steps following "DeployAndStartPorts" are not executed!
Namely - "DeployBtsNtSvcExeConfig" and then "StartApplication".  Since this is the first time we've used the AppDomain switch, we've never seen any side-effects of our "Control-C and continue" process before.

So, I guess this AppDomain problem is solved.  Though it is strange that the config file gets modified (and backed up) before the step actually executes.

So as not to "muddy this thread" - I will start a new thread to discuss this hanging issue.
Thanks for the feedback.

Chris