<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Application Server Group ISV Partner Advisory Team</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/asgisv/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/asgisv/feed.xml</link>
    <description />
    <lastBuildDate>Wed, 17 Apr 2019 03:17:48 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Our New Blog Home</title>
      <link>https://docs.microsoft.com/archive/blogs/asgisv/our-new-blog-home</link>
      <pubDate>Wed, 30 Jun 2010 21:13:41 GMT</pubDate>
      <dc:creator><![CDATA[ValeryM]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/asgisv/2010/06/30/our-new-blog-home/</guid>
      <description><![CDATA[Please follow us on the new MSDN blog where a combined workforce of the ASG ISV Team and...]]></description>
      <content:encoded><![CDATA[<p>Please follow us on the <a href="https://blogs.msdn.com/appfabriccat"><strong>new MSDN blog</strong></a> where a combined workforce of the ASG ISV Team and BizTalk&nbsp;Customer Advisory Team (CAT)&nbsp;will continue providing the community with latest best practices and technical guidance covering the entire family of Microsoft's Application Server products and technologies.</p>]]></content:encoded>
    </item>
    <item>
      <title>Management Tasks for BizTalk CAT Instrumentation Framework - Fully Explained</title>
      <link>https://docs.microsoft.com/archive/blogs/asgisv/management-tasks-for-biztalk-cat-instrumentation-framework-fully-explained</link>
      <pubDate>Wed, 26 May 2010 19:26:04 GMT</pubDate>
      <dc:creator><![CDATA[ValeryM]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/asgisv/2010/05/26/management-tasks-for-biztalk-cat-instrumentation-framework-fully-explained/</guid>
      <description><![CDATA[The following post is intended to drill down into most common administrative tasks involved in the...]]></description>
      <content:encoded><![CDATA[  <p align="justify">The following post is intended to drill down into most common administrative tasks involved in the ETW event trace session management, specifically, as it relates to getting the true value of the <a href="https://blogs.msdn.com/b/asgisv/archive/2010/05/11/best-practices-for-instrumenting-high-performance-biztalk-solutions.aspx" target="_blank">BizTalk CAT Instrumentation Framework</a> by being able to extract data out of the instrumented BizTalk application code into traditional human-readable trace log file.</p>  <h3>Event Trace Management Application Landscape</h3>  <p align="justify">The Event Tracing for Windows (ETW) infrastructure provides the ability to start and stop event tracing sessions, monitor their status, configure a variety of logging settings such as buffer size, flush interval, stop conditions and more. The majority of the administrative tasks are available from both the GUI and the command-line interface to suit the needs and preferences of different IT persona types.</p>  <p align="justify">In addition to using the <a href="https://technet.microsoft.com/en-us/library/cc755081(WS.10).aspx" target="_blank"><strong>Reliability and Performance Monitor</strong></a>, the application developers and technical teams have access to other system tools and scripts helping automate many aspects of event trace management:</p>  <ul>   <li>     <div align="justify"><a href="https://technet.microsoft.com/en-us/library/cc753820(WS.10).aspx" target="_blank"><strong>Logman</strong></a> creates and manages Event Trace Session and Performance logs and supports many functions of Performance Monitor from the command line.</div>   </li>    <li>     <div align="justify"><a href="https://technet.microsoft.com/en-us/library/cc732848(WS.10).aspx" target="_blank"><strong>WEvtUtil</strong></a> enables to retrieve information about event logs and publishers, install and uninstall event manifests, run queries, export, archive, and clear logs.</div>   </li>    <li>     <div align="justify"><a href="https://www.microsoft.com/downloads/details.aspx?FamilyID=55E51B3B-6C26-4CA0-ABF1-0E51D92B8298&amp;displaylang=en" target="_blank"><strong>Tracelog</strong></a> starts, stops, or enables trace logging.</div>   </li>    <li>     <div align="justify"><a href="https://msdn.microsoft.com/en-us/library/ff552974(VS.85).aspx" target="_blank"><strong>Tracefmt</strong></a> formats and displays trace messages from an event trace log file or a real-time trace session.</div>   </li> </ul>  <p align="justify">The BizTalk CAT Instrumentation Framework simplifies the use of the above tools by providing 2 easy-to-use scripts with a minimum of command-line parameters. These scripts can be found in the <em>TracingTools</em> folder and are intended to address the following requirements:</p>  <ul>   <li>     <div align="justify"><strong>StartTrace.cmd</strong> provides the ability to start an ETW event trace session either for the entire instrumented BizTalk solution, its selected component types or individually instrumented classes. This script is nothing more than just a wrapper for the <em>Tracelog</em> tool from the Windows Resource Kit.</div>   </li>    <li>     <div align="justify"><strong>StopTrace.cmd</strong> carries the responsibility for stopping the ETW event trace sessions and converting a binary trace log file into human-readable format. This script relies on <em>Tracelog</em> and <em>Tracefmt</em> tools to flush, stop and apply formatting to the trace logs.</div>   </li> </ul>  <p align="justify">The next section is intended to clarify how the above administrative scripts map to various management scenarios.</p>  <h3>Event Trace Management Tasks</h3>  <p align="justify">Once deployed and launched, a well instrumented BizTalk application will be ready to emit a number of events related to the application’s behavior, internal state, execution scope durations, runtime exceptions and everything else that the application developers decided to include into the instrumentation context. The top management tasks involved into capturing, filtering and persisting the instrumented events can be summarized as follows.</p>  <h4>Starting Event Trace Sessions</h4>  <p align="justify">To start an event tracing session for the entire instrumented BizTalk application, run <strong>StartTrace.cmd</strong> using one of following commands depending on the trace level required (all/high/medium/low). Note that the <em><font color="#ff0000">log file name</font></em> specified after -<em><strong>log</strong></em> parameter can be any name but should not contain whitespaces.</p>  <pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; padding-left: 5px; width: 97%; padding-right: 5px; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"><pre style="background-color: #fbfbfb; margin: 0em; width: 97%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"><p><strong><font color="#008000">: All trace events (Info, Details, Warning, Error, In, Out, Start Scope, End Scope)</font></strong><br /><strong>StartTrace</strong> <font color="#0000ff">-log</font> <font color="#ff0000"><em>BtsAppAllEvents</em></font> <font color="#0000ff">-level</font> <font color="#ff0000"><strong>all</strong></font></p><p><strong><font color="#008000">: Limited trace events (Info, Warning, Error)</font></strong><br /><strong>StartTrace</strong> <font color="#0000ff">-log</font> <font color="#ff0000"><em>BtsAppCoreEvents</em></font> <font color="#0000ff">-level</font> <font color="#ff0000"><strong>high</strong></font></p><p><strong><font color="#008000">: Trace events indicating unexpected behavior (Warning, Error)</font></strong><br /><strong>StartTrace</strong> <font color="#0000ff">-log</font> <font color="#ff0000"><em>BtsAppUnexpectedEvents</em></font> <font color="#0000ff">-level</font> <font color="#ff0000"><strong>medium</strong></font></p><strong><font color="#008000">: Trace events related to runtime exceptions (Error)</font></strong><br /><strong>StartTrace</strong> <font color="#0000ff">-log</font> <font color="#ff0000"><em>BtsAppExceptions</em></font> <font color="#0000ff">-level</font> <font color="#ff0000"><strong>low</strong></font></pre></pre>

<p align="justify">To start an event tracing session for a specific type of application components, run <strong>StartTrace.cmd</strong> using one of following commands depending on the component type and trace level required:</p>

<pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; padding-left: 5px; width: 97%; padding-right: 5px; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"><pre style="background-color: #fbfbfb; margin: 0em; width: 97%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"><p><strong><font color="#008000">: Start trace for all instrumented pipeline components</font></strong><br /><strong>StartTrace</strong> <font color="#0000ff">-log</font> <font color="#ff0000"><em>PipelineComponentsAllEvents</em></font> <font color="#0000ff">-level</font> <font color="#ff0000">all <font color="#0000ff">-component</font> <font color="#ff0000"><strong>Pipeline</strong></font></font></p><p><font color="#008000"><strong>: Start trace for all instrumented orchestrations</strong><br /><strong><font color="#000000">StartTrace</font></strong> <font color="#0000ff">-log</font> <font color="#ff0000"><em>OrchestrationsAllEvents</em></font> <font color="#0000ff">-level</font> <font color="#ff0000">all <font color="#0000ff">-component</font> <font color="#ff0000"><strong>Workflow</strong></font></font></font></p><p><font color="#008000"><font color="#008000"><strong>: Start trace for all instrumented data access components</strong></font><br /><font color="#000000"><strong>StartTrace</strong></font> <font color="#0000ff">-log</font> <font color="#ff0000"><em>DataAccessComponentsAllEvents</em></font> <font color="#0000ff">-level</font> <font color="#ff0000">all <font color="#0000ff">-component</font> <font color="#ff0000"><strong>DataAccess</strong></font></font></font></p><p><font color="#008000"><font color="#008000"><strong>: Start trace for all instrumented maps or custom transform code</strong></font><br /><strong><font color="#000000">StartTrace</font></strong> <font color="#0000ff">-log</font> <font color="#ff0000"><em>MapsAllEvents</em></font> <font color="#0000ff">-level</font> <font color="#ff0000">all <font color="#0000ff">-component</font> <font color="#ff0000"><strong>Transform</strong></font></font></font></p><font color="#008000"><p><font color="#008000"><strong>: Start trace for all instrumented Web/WCF services or service proxies</strong></font><br /><strong><font color="#000000">StartTrace</font></strong> <font color="#0000ff">-log</font> <font color="#ff0000"><em>WCFServicesAllEvents</em></font> <font color="#0000ff">-level</font> <font color="#ff0000">all <font color="#0000ff">-component</font> <font color="#ff0000"><strong>Service</strong></font></font></p><font color="#008000"><p><font color="#008000"><strong>: Start trace for all instrumented business rules</strong></font><br /><strong><font color="#000000">StartTrace</font></strong> <font color="#0000ff">-log</font> <font color="#ff0000"><em>BusinessRulesAllEvents</em></font> <font color="#0000ff">-level</font> <font color="#ff0000">all <font color="#0000ff">-component</font> <font color="#ff0000"><strong>Rules</strong></font></font></p><font color="#008000"><p><font color="#008000"><strong>: Start trace for all instrumented BAM activities</strong></font><br /><strong><font color="#000000">StartTrace</font></strong> <font color="#0000ff">-log</font> <font color="#ff0000"><em>BAMActivitiesAllEvents</em></font> <font color="#0000ff">-level</font> <font color="#ff0000">all <font color="#0000ff">-component</font> <font color="#ff0000"><strong>Tracking</strong></font></font></p><font color="#008000"><font color="#008000"><strong>: Start trace for all instrumented custom .NET components</strong></font><br /><strong><font color="#000000">StartTrace</font></strong> <font color="#0000ff">-log</font> <font color="#ff0000"><em>CustomComponentsAllEvents</em></font> <font color="#0000ff">-level</font> <font color="#ff0000">all <font color="#0000ff">-component</font> <font color="#ff0000"><strong>Custom</strong></font></font></font></font></font></font></pre></pre>

<p align="justify">To start an event tracing session for <a href="https://blogs.msdn.com/b/asgisv/archive/2010/05/24/how-to-support-component-level-instrumentation-using-biztalk-cat-instrumentation-framework.aspx" target="_blank">individually instrumented application components</a>, the component’s <strong><em>Guid</em></strong> attribute value must be provided in the command line as per the following examples:</p>

<pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; padding-left: 5px; width: 97%; padding-right: 5px; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"><pre style="background-color: #fbfbfb; margin: 0em; width: 97%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"><p><strong><font color="#008000">: Start trace to capture all events for instrumented HL7Disassembler component</font></strong><br /><strong>StartTrace</strong> <font color="#0000ff">-log</font> <font color="#ff0000"><em>HL7DasmFullTrace</em></font> <font color="#0000ff">-level</font> <font color="#ff0000">all <font color="#0000ff">-component</font> <font color="#ff0000">Custom <font color="#0000ff">-guid</font> <strong>0EC4A54D-6B97-47C1-9118-A2BF8B4E7595</strong></font></font></p><strong><font color="#008000">: Start trace to capture errors in instrumented HL7Disassembler component</font></strong><br /><strong>StartTrace</strong> <font color="#0000ff">-log</font> <font color="#ff0000"><em>HL7DasmErrorTrace</em></font> <font color="#0000ff">-level</font> <font color="#ff0000">low <font color="#0000ff">-component</font> <font color="#ff0000">Custom <font color="#0000ff">-guid</font> <strong>0EC4A54D-6B97-47C1-9118-A2BF8B4E7595</strong></font></font><font color="#008000"><font color="#008000"><font color="#008000"><font color="#008000"><font color="#008000"></font></font></font></font></font></pre></pre>

<h4>
  <h4>
    <h4>Monitoring Event Trace Sessions</h4>
  </h4>
</h4>

<p align="justify">After an event tracing session is started, it will remain running until it is manually stopped, a stop condition is encountered or host is rebooted. To query the present status of the event tracing sessions, one of the following approaches can be used.</p>

<p align="justify">To find out the event tracing session status from the command line, run the <strong>Logman</strong> utility using the following syntax:</p>

<pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; padding-left: 5px; width: 97%; padding-right: 5px; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"><pre style="background-color: #fbfbfb; margin: 0em; width: 97%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"><p><strong><font color="#008000">: Lists all event tracing sessions configured on the local machine</font></strong><br /><strong>Logman</strong> <font color="#ff0000"><font color="#0000ff">query</font> </font><font color="#0000ff">-ets</font></p><strong><font color="#008000">: Lists all event tracing sessions with a name matching the specified pattern</font></strong><br /><strong>Logman</strong> <font color="#ff0000"><font color="#0000ff">query</font> </font><font color="#0000ff">-ets | </font><font color="#333333"><strong>find </strong><font color="#ff0000">&quot;</font></font><font color="#ff0000">AllEvents</font><font color="#ff0000">&quot;</font><font color="#008000"><font color="#008000"><font color="#008000"><font color="#008000"><font color="#008000"></font></font></font></font></font></pre></pre>

<p align="justify">To find out the event tracing session status from the GUI, open Reliability and Performance Monitor and navigate to the <em>Event Trace Sessions</em> section.</p>

<p align="justify"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Running ETW Sessions" border="0" alt="Running ETW Sessions" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/33/60/metablogapi/2084.RunningETWSessions_0F6FDD1E.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-60-metablogapi/2084.RunningETWSessions_5F00_0F6FDD1E.png" width="600" height="307" /> </p>

<h4>Stopping Event Trace Sessions</h4>

<p align="justify">To stop a running event trace session, the target tools differ depending on whether or not the trace session must be temporarily suspended or terminated with no intent to resume. Consequently, one of the following approaches can be used.</p>

<p align="justify">To stop an event tracing session from the command line, run <strong>StopTrace.cmd</strong> passing the original name of the trace log without file extension:</p>

<pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; padding-left: 5px; width: 97%; padding-right: 5px; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"><pre style="background-color: #fbfbfb; margin: 0em; width: 97%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"><p><strong><font color="#008000">: Stop trace for all instrumented pipeline components</font></strong><br /><strong>StopTrace</strong> <font color="#0000ff">-log</font> <font color="#ff0000"><em>PipelineComponentsAllEvents</em></font></p><font color="#008000"><p><strong>: Stop trace for all instrumented orchestrations</strong><br /><strong><font color="#000000">StopTrace</font></strong> <font color="#0000ff">-log</font> <font color="#ff0000"><em>OrchestrationsAllEvents</em></font></p></font><p><font color="#008000"><font color="#008000"><strong>: Stop trace for all instrumented data access components</strong></font><br /><font color="#000000"><strong>StopTrace</strong></font> <font color="#0000ff">-log</font> <font color="#ff0000"><em>DataAccessComponentsAllEvents</em></font></font></p><font color="#008000"><p><font color="#008000"><strong>: Stop trace for all instrumented maps or custom transform code</strong></font><br /><strong><font color="#000000">StopTrace</font></strong> <font color="#0000ff">-log</font> <font color="#ff0000"><em>MapsAllEvents</em></font></p><font color="#008000"><p><font color="#008000"><strong>: Stop trace for all instrumented Web/WCF services or service proxies</strong></font><br /><strong><font color="#000000">StopTrace</font></strong> <font color="#0000ff">-log</font> <font color="#ff0000"><em>WCFServicesAllEvents</em></font></p><font color="#008000"><p><font color="#008000"><strong>: Stop trace for all instrumented business rules</strong></font><br /><strong><font color="#000000">StopTrace</font></strong> <font color="#0000ff">-log</font> <font color="#ff0000"><em>BusinessRulesAllEvents</em></font></p><font color="#008000"><p><font color="#008000"><strong>: Stop trace for all instrumented BAM activities</strong></font><br /><strong><font color="#000000">StopTrace</font></strong> <font color="#0000ff">-log</font> <font color="#ff0000"><em>BAMActivitiesAllEvents</em></font></p><font color="#008000"><font color="#008000"><strong>: Stop trace for all instrumented custom .NET components</strong></font><br /><strong><font color="#000000">StopTrace</font></strong> <font color="#0000ff">-log</font> <font color="#ff0000"><em>CustomComponentsAllEvents</em></font></font></font></font></font></font></pre></pre>

<p align="justify">Note that <strong>StopTrace.cmd</strong> will also convert the binary trace log into text-based format using the <em>Tracefmt</em> tool. Depending on the log size and disk IO performance, this operation can take a few minutes.</p>

<p align="justify">To temporarily suspend an event tracing session from the command line without producing a text-based log file, run the <strong>Logman</strong> utility using the following syntax:</p>

<pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; padding-left: 5px; width: 97%; padding-right: 5px; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"><pre style="background-color: #fbfbfb; margin: 0em; width: 97%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"><strong><font color="#008000">: Stop event tracing sessions all instrumented pipeline components, do not convert log into text file</font></strong><br /><strong>Logman</strong> <font color="#ff0000"><font color="#0000ff">stop</font> <em>PipelineComponentsAllEvents</em> </font><font color="#0000ff">-ets</font></pre></pre>

<p align="justify">To temporarily suspend the event tracing session from the GUI, open Reliability and Performance Monitor, navigate to the <em>Event Trace Sessions</em> section, right-click on the target event tracing session and select Stop from the context menu:</p>

<p align="justify"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Stopping ETW Sessions" border="0" alt="Stopping ETW Sessions" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/33/60/metablogapi/3482.StoppingETWSessions_6E7C6A76.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-60-metablogapi/3482.StoppingETWSessions_5F00_6E7C6A76.png" width="600" height="370" /> </p>

<h4>Configuring Event Trace Sessions</h4>

<p align="justify">The default configuration of the ETW event trace sessions created by <strong>StartTrace.cmd</strong> can be attributed as follows:</p>

<ul>
  <li><strong>Buffer Size:</strong> 128K </li>

  <li><strong>Maximum Buffers:</strong> 100 </li>

  <li><strong>Log Mode:</strong> Circular </li>

  <li><strong>Maximum Log Size:</strong> 1000MB </li>

  <li><strong>Flush Time:</strong> Not Set </li>

  <li><strong>Clock Type:</strong> Performance </li>

  <li><strong>Stream Mode:</strong> File </li>

  <li><strong>Pre-allocate File Space:</strong> No </li>
</ul>

<p align="justify">Should the default configuration be found insufficient and need modifications, the script can be updated to include the desired configuration settings. The new settings must be specified in the following line in <strong>StartTrace.cmd</strong>:</p>

<p></p>

<pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; padding-left: 5px; width: 97%; padding-right: 5px; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"><pre style="background-color: #fbfbfb; margin: 0em; width: 97%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"><strong>&quot;%TraceLogTool%&quot;</strong> <font color="#ff0000">-cir 1000 -b 128 -max 100 </font><font color="#0000ff">-start %TraceLogName% -flags %TraceLevel% -f %TraceLogFileName% -guid #%TraceComponentGUID%</font></pre></pre>

<p align="justify">Note that all commands shown <font color="#0000ff">in blue</font> will not require any modification. Below are the summary of command line parameters supported by the <em>Tracelog</em> tool:</p>

<pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; padding-left: 5px; width: 97%; padding-right: 5px; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"><pre style="background-color: #fbfbfb; margin: 0em; width: 97%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"><p><strong>Usage: tracelog [actions] [options] | [-h | -help | -?]</strong></p><p><strong>actions:<br /> -start&#160;&#160; [LoggerName] Starts up the [LoggerName] trace session<br /> -stop&#160;&#160;&#160; [LoggerName] Stops the [LoggerName] trace session<br /> -update&#160; [LoggerName] Updates the [LoggerName] trace session<br /> -enable&#160; [LoggerName] Enables providers for the [LoggerName] session<br /> -disable [LoggerName] Disables providers for the [LoggerName] session<br /> -flush&#160;&#160; [LoggerName] Flushes the [LoggerName] active buffers<br /> -remove&#160; GlobalLogger Removes registry keys that activate GlobalLogger<br /> -enumguid&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Enumerate Registered Trace Guids<br /> -q&#160;&#160;&#160;&#160;&#160;&#160; [LoggerName] Query status of [LoggerName] trace session<br /> -l&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; List all trace sessions<br /> -x&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Stops all active trace sessions</strong></p><strong>options:<br /> -b&#160;&#160; &lt;n&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Sets buffer size to &lt;n&gt; Kbytes<br /> -min &lt;n&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Sets minimum buffers<br /> -max &lt;n&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Sets maximum buffers<br /> -f &lt;name&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Log to file &lt;name&gt;<br /> -append&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Append to file<br /> -prealloc&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Pre-allocate<br /> -seq &lt;n&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Sequential logfile of up to n Mbytes<br /> -cir &lt;n&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Circular logfile of n Mbytes<br /> -newfile &lt;n&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Log to a new file after every n Mbytes<br /> -ft &lt;n&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Set flush timer to n seconds<br /> -paged&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Use pageable memory for buffers<br /> -noprocess&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Disable Process Start/End tracing<br /> -nothread&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Disable Thread Start/End tracing<br /> -nodisk&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Disable Disk I/O tracing<br /> -nonet&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Disable Network TCP/IP tracing<br /> -fio&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Enable file I/O tracing<br /> -pf&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Enable page faults tracing<br /> -hf&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Enable hard faults tracing<br /> -img&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Enable image load tracing<br /> -cm&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Enable registry calls tracing<br /> -um&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Enable Process Private tracing<br /> -guid &lt;file&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Start tracing for providers in file<br /> -rt&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Enable tracing in real time mode<br /> -kd&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Enable tracing in kernel debugger<br /> -age &lt;n&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Modify aging decay time to n minutes<br /> -level &lt;n&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Enable Level passed to the providers<br /> -flag &lt;n&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Enable Flags passed to the providers<br /> -eflag &lt;n&gt; &lt;flag...&gt;&#160; Enable flags (several) to providers<br /> -ls&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Generate Local Sequence Numbers<br /> -gs&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Generate Global Squence Numbers<br /> -heap&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Use this for Heap Guid<br /> -critsec&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Use this for CritSec Guid<br /> -pids &lt;n&gt; &lt;pid1... &gt;  Tracing for Heap and CritSec for different process</strong></pre></pre>

<p align="justify">For more information on the related topic, please visit the following resources: </p>

<ul>
  <li>
    <div align="justify">“<a href="https://technet.microsoft.com/en-us/library/cc753820(WS.10).aspx" target="_blank">Logman Utility Command-line Reference</a>” on TechNet</div>
  </li>

  <li>
    <div align="justify">“<a href="https://msdn.microsoft.com/en-us/library/ff553026.aspx" target="_blank">Tracelog Utility Command-line Reference</a>”article in the MSDN Library</div>
  </li>

  <li>
    <div align="justify">“<a href="https://msdn.microsoft.com/en-us/library/aa363694(v=VS.85).aspx" target="_blank">Controlling Event Tracing Sessions</a>” article in the MSDN Library</div>
  </li>

  <li>
    <div align="justify">“<a href="https://msdn.microsoft.com/en-us/library/ff552961(v=VS.85).aspx" target="_blank">Tools for Software Tracing</a>“ article in the MSDN Library</div>
  </li>
</ul>]]></content:encoded>
    </item>
    <item>
      <title>How to Support Component-Level Instrumentation Using BizTalk CAT Instrumentation Framework</title>
      <link>https://docs.microsoft.com/archive/blogs/asgisv/how-to-support-component-level-instrumentation-using-biztalk-cat-instrumentation-framework</link>
      <pubDate>Mon, 24 May 2010 15:28:31 GMT</pubDate>
      <dc:creator><![CDATA[ValeryM]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/asgisv/2010/05/24/how-to-support-component-level-instrumentation-using-biztalk-cat-instrumentation-framework/</guid>
      <description><![CDATA[In one of our recent publications, we explained the key usage patterns for the ETW-based...]]></description>
      <content:encoded><![CDATA[<p align="justify">In one of our recent publications, we explained the key usage patterns for the ETW-based instrumentation framework which was made available to the community on the <a href="https://code.msdn.microsoft.com/btscat" target="_blank">BizTalk CAT Best Practices Code Gallery</a>. We have received a number of insightful follow-ups and interesting questions and one of them has triggered the following post.</p>  <h2>Scenario</h2>  <p align="justify">A BizTalk solution running in a production environment manifests a noticeable performance degradation. The operations team investigates the problem and arrives to a conclusion that it might be related to a bottleneck in a custom component used by a number of orchestrations in the BizTalk solution. The operations team would like to collect detailed diagnostic information to assert the validity of the above assumption. They want to be able to understand the component behavior as it relates to functions being invoked, measuring accurate durations of the method calls as well as tracing parameter values being used for execution.</p>  <p align="justify">Luckily, the BizTalk solution was fully instrumented using the ETW instrumentation framework by following the <a href="https://blogs.msdn.com/asgisv/archive/2010/05/11/best-practices-for-instrumenting-high-performance-biztalk-solutions.aspx" target="_blank">technical guidance</a> and best practices from the BizTalk Customer Advisory Team (CAT). The operations team has full access and all the required privileges to be able to enable ETW tracing in the production environment. However, they might face with a new challenge.</p>  <h2>Challenge</h2>  <p align="justify">The complexity of the BizTalk solution in question has led to implementing a number of custom components spreading across the end-to-end architecture. Virtually all custom components have been enriched with relevant tracing and instrumentation events. When enabled, the ETW trace log contains thousands of events generated by these custom components. This makes it time consuming to locate the events produced by the suspected component causing a performance degradation. In addition, many events are being written by multiple components running simultaneously on separate threads and this increases the complexity in performing trace log data analysis.</p>  <p align="justify">The operations team would like to streamline the troubleshooting process by capturing only those events which are directly related to the component being investigated. Ideally, they want to be able to have these events written into a separate trace log so that it can also be shared with the developers to get their input. The operations staff opens a dialogue with the development team and finds that there is a solution provided by the developers and is already available in the production codebase.</p>  <h2>Solution</h2>  <p align="justify">When implementing core custom components for the BizTalk solution, the development team has made a decision to support the extra level of granularity and add instrumentation at the individual component level. The advantage of this approach is that trace events produced by individual .NET components can be captured in isolation from the others. This approach opens the opportunity for collecting the detailed behavioral and telemetry data related to a specific component whilst ensuring that any events produced by other custom components will not interfere with the trace log content.</p>  <p align="justify">The underlying implementation has rather been very straightforward.</p>  <p align="justify">First, the <em><strong>TraceManager</strong></em> class from the <em><strong>Microsoft.BizTalk.CAT.BestPractices.Framework.Instrumentation</strong></em> namespace was enriched with a new public static method:</p>  <pre class="csharpcode"><span class="rem">// Returns an instance of a trace provider for the specified type. This requires that the type supplies its Guid </span>
<span class="rem">// which will be used for registering it with the ETW infrastructure.</span>
<span class="kwrd">public</span> <span class="kwrd">static</span> <span class="preproc">IComponentTraceProvider</span> Create(<span class="preproc">Type</span> componentType)
{
    <span class="preproc">GuidAttribute</span> guidAttribute = <span class="preproc">FrameworkUtility</span>.GetDeclarativeAttribute&lt;<span class="preproc">GuidAttribute</span>&gt;(componentType);

    <span class="kwrd">if</span> (guidAttribute != <span class="kwrd">default</span>(<span class="preproc">GuidAttribute</span>))
    {
        <span class="kwrd">return</span> <span class="kwrd">new</span> <span class="preproc">ComponentTraceProvider</span>(componentType.FullName, <span class="kwrd">new</span> <span class="preproc">Guid</span>(guidAttribute.Value));
    }
    <span class="kwrd">else</span>
    {
        <span class="kwrd">throw</span> <span class="kwrd">new</span> <span class="preproc">MissingMemberException</span>(componentType.FullName, <span class="kwrd">typeof</span>(<span class="preproc">GuidAttribute</span>).FullName);
    }
}</pre>


<p align="justify">Secondly, every .NET component which required to be individually instrumented was decorated with a <em><strong><a href="https://msdn.microsoft.com/en-us/library/system.runtime.interopservices.guidattribute.aspx" target="_blank">Guid</a></strong></em> attribute available in the <em><strong>System.Runtime.InteropServices</strong></em> namespace.</p>

<p align="justify"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Guid Attribute on a Custom Component" border="0" alt="Guid Attribute on a Custom Component" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/33/60/metablogapi/2260.GuidAttributeonaCustomComponent_3486D491.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-60-metablogapi/2260.GuidAttributeonaCustomComponent_5F00_3486D491.png" width="700" height="128" /> </p>

<p align="justify">Next, a new <em><strong>protected readonly static</strong>&#160;</em>field was added into each non-sealed instrumented .NET component. For sealed classes, the <em><strong>private readonly static</strong>&#160;</em>modifier was used. This class member is statically initialized with an instance of the framework component implementing the <em><strong>IComponentTraceProvider</strong></em> interface which provides a rich set of tracing and instrumentation methods.</p>

<p align="justify">&#160;<img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Custom Trace Manager Declaration" border="0" alt="Custom Trace Manager Declaration" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/33/60/metablogapi/6724.CustomTraceManagerDeclaration_1FB4DC11.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-60-metablogapi/6724.CustomTraceManagerDeclaration_5F00_1FB4DC11.png" width="600" height="180" /> </p>

<p align="justify">Lastly, all important aspects of the custom components’ behavior were wisely instrumented by calling the relevant tracing methods provided by the above static class member as opposed to using <strong><em>TraceManager.CustomComponent</em></strong>:</p>

<p align="justify"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Custom Trace Manager Usage" border="0" alt="Custom Trace Manager Usage" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/33/60/metablogapi/3582.CustomTraceManagerUsage_48040E65.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-60-metablogapi/3582.CustomTraceManagerUsage_5F00_48040E65.png" width="700" height="365" /> </p>

<p></p>

<p></p>

<h2>Summary</h2>

<p align="justify">This article was intended to demonstrate the simple and very powerful approach to supporting the&#160; code instrumentation in the custom .NET components to be able to capture trace events for individual components. The benefits of this technique lies in the ability to collect only those events which are necessary to perform troubleshooting of specific components in the BizTalk solutions, eliminate&#160; “noisy events” which may come from other components, reduce the amount of events in the trace log and greatly reduce the time required to analyze the trace log data.</p>]]></content:encoded>
    </item>
    <item>
      <title>Scripting Window Server AppFabric Configuration</title>
      <link>https://docs.microsoft.com/archive/blogs/asgisv/scripting-window-server-appfabric-configuration</link>
      <pubDate>Thu, 20 May 2010 05:07:00 GMT</pubDate>
      <dc:creator><![CDATA[ValeryM]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/asgisv/2010/05/20/scripting-window-server-appfabric-configuration/</guid>
      <description><![CDATA[Windows PowerShell cmdlets are an administration-focused scripting language that helps you achieve...]]></description>
      <content:encoded><![CDATA[<p align="justify"><a title="_GoBack" name="_GoBack"></a>Windows PowerShell cmdlets are an administration-focused scripting language that helps you achieve control and productivity when managing your Windows Server AppFabric installation.&#160; There are cmdlets particular to AppFabric and those that are generic in nature.&#160; The output results of one cmdlet can be piped to another cmdlet by combining the two statements with a single command and the “|” operator. You can invoke Windows PowerShell cmdlets either interactively using the Windows PowerShell console or through scripts. This brings the power of the .NET Framework to command-line users as well as script writers.&#160; Just like the IIS interface, the AppFabric cmdlets can be used to manage remote services and applications.</p>  <p align="justify">As an administrator you may want to create scripts for specific core tasks. This saves time with duties that are done on a repetitive basis. It also makes the process less error prone since each time you will be running the same script file time through that task. </p>  <p align="justify">A commonly scripted task that you may want to manage through cmdlets is the AppFabric configuration process. We will now examine some core configuration operations that you can script for AppFabric to function correctly after the installation.&#160;&#160; Before running these cmdlets, the following steps in the installation process must complete in order to properly configure AppFabric using scripting.</p>  <ul>   <li>     <div align="justify">Databases have been prepared using the <b>Initialize-ASMonitoringDatabase</b> and <b>Initialize-ASPersistenceSqlDatabase</b> cmdlets. There may be permissions issues that need to be addressed before this will work that are particular to the security requirements at your installation.</div>   </li>    <li>The users of the Administrator role must have <b>logon as a service</b> privileges because they will be used to run the Event Collection and Workflow Management services. </li>    <li>The identity of the application pool used to run AppFabric applications must be a member of the logical AppFabric Users role. </li>    <li>The application pool must be a .NET Framework 4 application pool. </li> </ul>  <p>Note that in this article we will not discuss installing, configuring, and securing AppFabric on a domain or across a Web farm. </p>  <p>   <table border="0" cellspacing="0" cellpadding="0"><tbody>       <tr>         <td valign="top" width="319">           <p><b>CMDLET/CMD OPERATION</b></p>         </td>          <td valign="top" width="496">           <p><b>ACTION</b></p>         </td>       </tr>        <tr>         <td valign="top" width="319">           <p><i>NET LOCALGROUP</i></p>         </td>          <td valign="top" width="496">           <p>Add the AppFabric Administrator user to the local Administrators group.</p>            <p>NET LocalGroup is a command line executable. One example is: net localgroup Administrators /Add testuser</p>         </td>       </tr>        <tr>         <td valign="top" width="319">           <p><i>Get-WmiObject</i></p>         </td>          <td valign="top" width="496">           <p>Set the Event Collection Service and Workflow Management Service identities.</p>            <p><i>Get-WmiObject</i> is a command line executable. </p>         </td>       </tr>        <tr>         <td valign="top" width="319">           <p><i>AppCmd</i></p>         </td>          <td valign="top" width="496">           <p>Add connection strings to the connection strings section in root web.config.</p>            <p>AppCmd is a command line executable and used for configuring AppPool Identity with AppCmd.</p>            <p>appcmd set config /section:applicationPools /[name='Marketing'].processModel.identityType:SpecificUser /[name='Marketing'].processModel.userName: Marketer /[name='Marketing'].processModel.password: M@dr1d$P</p>         </td>       </tr>        <tr>         <td valign="top" width="319">           <p><i>AppCmd</i></p>         </td>          <td valign="top" width="496">           <p>Set the default AppPool identity.</p>         </td>       </tr>        <tr>         <td valign="top" width="319">           <p><i>Initialize-ASPersistenceSqlDatabase</i></p>            <p><i></i></p>         </td>          <td valign="top" width="496">           <p>Creates and initializes a SQL Server persistence database on the specified database server if the specified database does not already exist on the server. The initialization process creates persistence-related artifacts (tables, views, stored procedures, and so on). If the database already exists on the server, the cmdlet initializes the database with the persistence artifacts. The cmdlet also adds any specified Windows groups to corresponding SQL Server roles.</p>         </td>       </tr>        <tr>         <td valign="top" width="319">           <p><i>Initialize-ASMonitoringSqlDatabase</i><i></i></p>         </td>          <td valign="top" width="496">           <p>Creates and initializes a SQL Server monitoring database on the specified database server if the specified database does not already exist on the server. The initialization process creates monitoring-related artifacts (tables, views, stored procedures, and so on). If the database already exists on the server, the cmdlet initializes the database with the monitoring artifacts. The cmdlet also adds any specified Windows groups to corresponding SQL Server roles.</p>         </td>       </tr>        <tr>         <td valign="top" width="319">           <p><i>Set-ASAppMonitoring</i></p>         </td>          <td valign="top" width="496">           <p>Enables monitoring and specifies the connection string that will be used to connect to the SQL Server monitoring database, </p>         </td>       </tr>        <tr>         <td valign="top" width="319">           <p><i>Set-ASAppSqlServicePersistence</i></p>         </td>          <td valign="top" width="496">           <p>Enables SQL Server persistence, specifies the connection string that will be used to connect to the SQL Server persistence database, and sets advanced persistence related parameters at the specified level.</p>         </td>       </tr>     </tbody></table> </p>  <p align="justify">These cmdlets can be run individually, or put inside a script file with a .ps1 extension to run as a Windows PowerShell Script. Here is an example of a script to assist in configuration of AppFabric.&#160; The script has four functions and three sections.&#160; Its main goals of this script are to get the user to enter a user name and password, change the logon user and password for a specified service, generate a SQL connection string to a specific database, and to add that connection string to the root Web.config file. To run these commands, load PowerShell and then load the ApplicationServer module using command (in PowerShell) Import-Module ApplicationServer.</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> ############################################################</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> # PowerShell script <span style="color: #0000ff">to</span> configure</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span> # Application Server Extensions <span style="color: #0000ff">for</span> .NET 4</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span> # Copyright (c) Microsoft Corporation.  All rights reserved.</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span> ############################################################</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span> <span style="color: #0000ff">if</span> ((Get-Command -Module ApplicationServer) -eq $null)</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span> {</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>     Import-Module ApplicationServer # Application Server Extensions <span style="color: #0000ff">for</span> .NET 4</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span> }</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span>&#160; </pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11">  11:</span> ############################################################</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum12">  12:</span> function GetUserCredential([string]$serviceName, [string]$serviceDescription, [string]$serviceUser)</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum13">  13:</span> {</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum14">  14:</span>     $credential = $host.ui.PromptForCredential($serviceName, $serviceDescription, $serviceUser, <span style="color: #006080">&quot;&quot;</span>)</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum15">  15:</span>     <span style="color: #0000ff">return</span> $credential # PSCredential object</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum16">  16:</span> }</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum17">  17:</span>&#160; </pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum18">  18:</span> function SetServiceCredential([string]$serviceName, $credential)</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum19">  19:</span> {</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum20">  20:</span>     $domainAndUserName = $credential.GetNetworkCredential().Domain + <span style="color: #006080">&quot;\&quot;</span> + $credential.GetNetworkCredential().UserName<span style="color: #008000">;</span></pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum21">  21:</span> <span style="color: #008000">    $service = Get-WmiObject Win32_Service -filter &quot;name='$serviceName'&quot;</span></pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum22">  22:</span>     $service.Change($null, $null, $null, $null, $null, $null, $domainAndUserName, $credential.GetNetworkCredential().Password) |out-null</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum23">  23:</span>     Restart-Service -name <span style="color: #006080">&quot;$serviceName&quot;</span></pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum24">  24:</span> }</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum25">  25:</span>&#160; </pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum26">  26:</span> #### Gets a SQL connection string <span style="color: #0000ff">to</span> the specified server and database.</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum27">  27:</span> function GetSqlConnectionString([string]$server, [string]$database)</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum28">  28:</span> {</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum29">  29:</span>     $builder = New-Object System.Data.SqlClient.SqlConnectionStringBuilder</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum30">  30:</span>     $builder.PSBase.DataSource = $server</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum31">  31:</span>     $builder.PSBase.InitialCatalog = $database</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum32">  32:</span>     $builder.PSBase.IntegratedSecurity = $<span style="color: #0000ff">true</span></pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum33">  33:</span>     <span style="color: #0000ff">return</span> [string] $builder.ToString()</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum34">  34:</span> }</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum35">  35:</span>&#160; </pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum36">  36:</span> #### Adds or updates the specified connection string setting <span style="color: #0000ff">in</span> the specified .NET configuration file.</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum37">  37:</span> function UpdateConnectionString([string]$name, [string]$connectionString, [string]$providerName)</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum38">  38:</span> {  </pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum39">  39:</span>     &amp;<span style="color: #008000">; $appcmd set config /clr:4 /commit:WEBROOT /section:connectionStrings /+&quot;[connectionString='$connectionString',name='$name',providerName='$providerName']&quot; |out-null</span></pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum40">  40:</span> }</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum41">  41:</span>&#160; </pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum42">  42:</span> ##############################</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum43">  43:</span> ### User defined variables ###</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum44">  44:</span> ### List of variables used <span style="color: #0000ff">in</span> the script. You can modify these variables <span style="color: #0000ff">to</span> customize the script <span style="color: #0000ff">to</span> the specifics of the environment.</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum45">  45:</span> ##############################</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum46">  46:</span>&#160; </pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum47">  47:</span> $computer = <span style="color: #006080">&quot;.&quot;</span></pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum48">  48:</span> $appcmd = <span style="color: #006080">&quot;$env:SystemRoot\system32\inetsrv\appcmd.exe&quot;</span></pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum49">  49:</span>&#160; </pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum50">  50:</span> ### Event Collector Service (ECS) and Workflow Management Service (WMS) service names.</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum51">  51:</span> $ECS_ServiceName = <span style="color: #006080">&quot;AppFabricEventCollectionService&quot;</span></pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum52">  52:</span> $WMS_ServiceName = <span style="color: #006080">&quot;AppFabricWorkflowManagementService&quot;</span></pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum53">  53:</span>&#160; </pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum54">  54:</span> ### Domain user, member of Application Server Administrators group.</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum55">  55:</span> ### ECS and WMS will run under this identity.</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum56">  56:</span> $systemService_Domain =<span style="color: #006080">&quot;corp&quot;</span></pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum57">  57:</span> $systemService_UserName = <span style="color: #006080">&quot;dubAdmin&quot;</span></pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum58">  58:</span>&#160; </pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum59">  59:</span> ### Monitoring database</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum60">  60:</span> $Monitoring_ConnectionStringName = <span style="color: #006080">&quot;monitoringDB&quot;</span></pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum61">  61:</span> $Monitoring_ConnectionString = GetSqlConnectionString <span style="color: #006080">&quot;AD-SQL&quot;</span> <span style="color: #006080">&quot;monitoringDB&quot;</span></pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum62">  62:</span>&#160; </pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum63">  63:</span> $Monitoring_MonitoringLevel = <span style="color: #006080">&quot;HealthMonitoring&quot;</span> # Used by the monitoring behavior.</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum64">  64:</span>&#160; </pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum65">  65:</span> ### Persistence database</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum66">  66:</span> $Persistence_ConnectionStringName = <span style="color: #006080">&quot;persistenceDB&quot;</span></pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum67">  67:</span> $Persistence_InstanceStoreName = <span style="color: #006080">&quot;sqlPersistence&quot;</span></pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum68">  68:</span> $Persistence_ConnectionString = GetSqlConnectionString <span style="color: #006080">&quot;AD-SQL&quot;</span> <span style="color: #006080">&quot;persistenceDB&quot;</span></pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum69">  69:</span>&#160; </pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum70">  70:</span> ###########################</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum71">  71:</span> ### Collect credentials ###</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum72">  72:</span> ### Calls the GetUserCredential function <span style="color: #0000ff">to</span> obtain credentials from the user <span style="color: #0000ff">for</span> use <span style="color: #0000ff">in</span> the configuration of the system services (Workflow Management service and Event Collection service).</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum73">  73:</span> ###########################</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum74">  74:</span>&#160; </pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum75">  75:</span> $systemService_Credentials = GetUserCredential <span style="color: #006080">&quot;System Services&quot;</span> <span style="color: #006080">&quot;Provide the credentials for the System Services user:&quot;</span> <span style="color: #006080">&quot;$systemService_Domain\$systemService_UserName&quot;</span></pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum76">  76:</span> $systemService_Domain = $systemService_Credentials.GetNetworkCredential().Domain</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum77">  77:</span> $systemService_UserName = $systemService_Credentials.GetNetworkCredential().UserName</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum78">  78:</span>&#160; </pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum79">  79:</span> ############################</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum80">  80:</span> ### Update configuration ###</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum81">  81:</span> ### Apply the configuration based on the variables and the collected information</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum82">  82:</span> ############################</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum83">  83:</span>&#160; </pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum84">  84:</span> ####Add the AppFabric Administrator user <span style="color: #0000ff">to</span> the <span style="color: #0000ff">local</span> Administrators group.</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum85">  85:</span> Write-Output <span style="color: #006080">&quot;Adding the Administrator user to the local Administrators group...&quot;</span></pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum86">  86:</span> $oGroup = [ADSI]<span style="color: #006080">&quot;WinNT://$computer/Administrators&quot;</span></pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum87">  87:</span> trap { continue } #'Administrator user already a member of the <span style="color: #0000ff">local</span> Administrators group...'<span style="color: #008000">; </span></pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum88">  88:</span> <span style="color: #008000">&amp; { $oGroup.Add(&quot;WinNT://$systemService_Domain/$systemService_UserName&quot;) }</span></pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum89">  89:</span>&#160; </pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum90">  90:</span> ####Set Event Collection service configuration.</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum91">  91:</span> Write-Output <span style="color: #006080">&quot;Updating Event Collection service...&quot;</span></pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum92">  92:</span> SetServiceCredential $ECS_ServiceName $systemService_Credentials</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum93">  93:</span>&#160; </pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum94">  94:</span> ####Set Workflow Management service configuration.</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum95">  95:</span> Write-Output <span style="color: #006080">&quot;Updating Workflow Management service...&quot;</span></pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum96">  96:</span> SetServiceCredential $WMS_ServiceName $systemService_Credentials</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum97">  97:</span>&#160; </pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum98">  98:</span> ####Add connection strings <span style="color: #0000ff">to</span> the connection strings section <span style="color: #0000ff">in</span> root web.config.Write-Output <span style="color: #006080">&quot;Creating connection strings...&quot;</span></pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum99">  99:</span> UpdateConnectionString $Monitoring_ConnectionStringName $Monitoring_ConnectionString <span style="color: #006080">&quot;System.Data.SqlClient&quot;</span> |out-null</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum100"> 100:</span> UpdateConnectionString $Persistence_ConnectionStringName $Persistence_ConnectionString <span style="color: #006080">&quot;System.Data.SqlClient&quot;</span> |out-null</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum101"> 101:</span>&#160; </pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum102"> 102:</span> ####Create an Instance Store entry <span style="color: #0000ff">for</span> the persistence connection string.</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum103"> 103:</span> Write-Output <span style="color: #006080">&quot;Creating Persistence Instance Store...&quot;</span></pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum104"> 104:</span> Add-ASAppSqlInstanceStore -Name $Persistence_InstanceStoreName -ConnectionStringName $Persistence_ConnectionStringName -Root |out-null</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum105"> 105:</span>&#160; </pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum106"> 106:</span> ####Set the persistence and monitoring behavior.</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum107"> 107:</span> Write-Output <span style="color: #006080">&quot;Creating default behaviors...&quot;</span> </pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum108"> 108:</span> Set-ASAppMonitoring -ConnectionStringName $Monitoring_ConnectionStringName -MonitoringLevel $Monitoring_MonitoringLevel -Root |out-null</pre>
<!--crlf-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum109"> 109:</span> Set-ASAppSqlServicePersistence -ConnectionStringName $Persistence_ConnectionStringName -Root -HostLockRenewalPeriod <span style="color: #006080">&quot;00:00:20&quot;</span> -InstanceEncodingOption <span style="color: #006080">&quot;GZip&quot;</span> -InstanceCompletionAction <span style="color: #006080">&quot;DeleteNothing&quot;</span> -InstanceLockedExceptionAction <span style="color: #006080">&quot;BasicRetry&quot;</span> |out-null</pre>
<!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></!--crlf--></div>
</div>]]></content:encoded>
    </item>
    <item>
      <title>Tips and Tricks in hosting .NET4 Workflow Designer: how to load a ‘blank’ Activity Builder Designer Grid!</title>
      <link>https://docs.microsoft.com/archive/blogs/asgisv/tips-and-tricks-in-hosting-net4-workflow-designer-how-to-load-a-blank-activity-builder-designer-grid</link>
      <pubDate>Mon, 17 May 2010 05:08:00 GMT</pubDate>
      <dc:creator><![CDATA[ValeryM]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/asgisv/2010/05/17/tips-and-tricks-in-hosting-net4-workflow-designer-how-to-load-a-blank-activity-builder-designer-grid/</guid>
      <description><![CDATA[Background: ISVs typically host the Workflow Designer to enable the ITPros use the tool set outside...]]></description>
      <content:encoded><![CDATA[<p><b>Background</b>: ISVs typically host the Workflow Designer to enable the ITPros use the tool set outside the Visual Studio UI experience. </p>  <p><b>Problem</b>: While loading a new Designer view in the rehosted Workflow Designer, the method <i>workflowDesigner.Load (new Sequence ())</i> by default loads an empty <i>Sequence Activity</i> in the Activity Builder designer grid (Figure 1).&#160; In some ISV scenarios, it may be preferred to load a ‘blank’ Activity Builder Designer Grid, so that the ITPro user is not restricted to using the <i>Sequence Activity</i>. Changing the parameters to <i>(null)</i> in the method (as <i>workflowDesigner.Load (null)</i>); does not help as the Workflow Designer Activity Builder is not loaded. </p>  <p><b><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image001" border="0" alt="clip_image001" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/asgisv/WindowsLiveWriter/d09e147a1bec_C493/clip_image001_f990571a-512b-4e4f-a378-45ec0cf14460.jpg" original-url="https://blogs.msdn.com/blogfiles/asgisv/WindowsLiveWriter/d09e147a1bec_C493/clip_image001_f990571a-512b-4e4f-a378-45ec0cf14460.jpg" width="570" height="263" mce_src="https://blogs.msdn.com/blogfiles/asgisv/WindowsLiveWriter/d09e147a1bec_C493/clip_image001_f990571a-512b-4e4f-a378-45ec0cf14460.jpg" /></b></p>  <p>Figure 1: Rehosted Designer while using Method <i>workflowDesigner.Load (new Sequence ())</i></p>  <p><b></b></p>  <p><b>Solution: </b>To mimic the Visual Studio Workflow Designer experience use the <i>ActivityBuilder</i> Method as<i>: LoadWorkflowDesigner(new System.Activities.ActivityBuilder()).</i></p>  <p><b><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image002" border="0" alt="clip_image002" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/asgisv/WindowsLiveWriter/d09e147a1bec_C493/clip_image002_cf3ce405-48f9-4597-a4be-b7175cec7fa7.jpg" original-url="https://blogs.msdn.com/blogfiles/asgisv/WindowsLiveWriter/d09e147a1bec_C493/clip_image002_cf3ce405-48f9-4597-a4be-b7175cec7fa7.jpg" width="576" height="368" mce_src="https://blogs.msdn.com/blogfiles/asgisv/WindowsLiveWriter/d09e147a1bec_C493/clip_image002_cf3ce405-48f9-4597-a4be-b7175cec7fa7.jpg" /></b></p>  <p>Figure 2: Rehosted Designer <i>ActivityBuilder</i> Method as: <i>LoadWorkflowDesigner(new System.Activities.ActivityBuilder())</i></p>]]></content:encoded>
    </item>
    <item>
      <title>Best Practices for Instrumenting High Performance BizTalk Solutions</title>
      <link>https://docs.microsoft.com/archive/blogs/asgisv/best-practices-for-instrumenting-high-performance-biztalk-solutions</link>
      <pubDate>Tue, 11 May 2010 12:51:00 GMT</pubDate>
      <dc:creator><![CDATA[ValeryM]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/asgisv/2010/05/11/best-practices-for-instrumenting-high-performance-biztalk-solutions/</guid>
      <description><![CDATA[During a recent technical engagement with a BizTalk ISV, we helped the ISV partner implement a...]]></description>
      <content:encoded><![CDATA[<p align="justify">During a recent technical engagement with a BizTalk ISV, we helped the ISV partner implement a tracing framework which combined the high performance and flexibility provided by the <a target="_blank" href="https://msdn.microsoft.com/en-us/library/aa363668(VS.85).aspx">Event Tracing for Windows (ETW)</a> infrastructure. This work has enabled us to produce and validate the foundation of the best practices for instrumenting BizTalk solutions. We are keen to share our lessons learned with the community to enable BizTalk developers to take advantage of the ETW infrastructure and enrich their solutions with high-performance instrumentation internally adopted by many Microsoft products. </p>
<h2>Background</h2>
<p align="justify">Code instrumentation has always been crucially important in complex software solutions. Rich tracing and logging enables collecting detailed telemetry and diagnostic information to understand application behavior and facilitate troubleshooting. This is especially important for server applications and BizTalk Server based-applications are surely among them. </p>
<p align="justify">We have seen many instances where BizTalk developers often add tracing and logging capabilities to their applications using inefficient methods and this can have adverse effect on the application performance. From the other side, BizTalk developers appear to be unaware of high-performance tracing capabilities which are provided directly by BizTalk. This article will help bridge the gap.</p>
<h2>Challenges</h2>
<p align="justify">The ISV partner has initially implemented component-level tracing by taking dependency on the <strong><em><a target="_blank" href="https://msdn.microsoft.com/en-us/library/system.diagnostics.trace.aspx">System.Diagnostics.Trace</a></em></strong> component in the .NET Framework. They also considered using a third-party logging/tracing component <strong><em><a target="_blank" href="https://logging.apache.org/log4net/">log4net</a></em></strong>. Both options didn&rsquo;t deliver the desired level of agility and performance. </p>
<p align="justify">The main observations can be summarized as follows:</p>
<ul>
<li>
<div align="justify"><strong>The CPU utilization was 85-90% </strong>on average when developers were running the <strong><em><a target="_blank" href="https://technet.microsoft.com/en-us/sysinternals/bb896647.aspx">DebugView</a></em></strong> tool to monitor the BizTalk application behavior. The tool was consuming the vast majority of the CPU time due to many events being logged by the BizTalk application. <br /><img height="365" width="700" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/asgisv/WindowsLiveWriter/BestPracticesforInstrumentingHighPerform_A53C/DebugView%20CPU%20Util_3.png" original-url="https://blogs.msdn.com/blogfiles/asgisv/WindowsLiveWriter/BestPracticesforInstrumentingHighPerform_A53C/DebugView%20CPU%20Util_3.png" alt="DebugView CPU Util" border="0" title="DebugView CPU Util" style="display: inline; border-width: 0px;" />&nbsp;</div>
</li>
<li>
<div align="justify"><strong>Running DebugView during stress testing was significantly impacting application performance.</strong> DebugView acts as a debugger and hooks on the <em><strong><a target="_blank" href="https://msdn.microsoft.com/en-us/library/ms679302(VS.85).aspx">OUTPUT_DEBUG_STRING_EVENT</a></strong></em> event. As a result, the BizTalk application was experiencing a performance impact as the application threads will be suspended whilst the debug information is written to the trace listener.</div>
</li>
<li>
<div align="justify"><strong>Poor tracing performance.</strong> The .NET Framework&rsquo;s standard <em>System.Diagnostics.Trace</em> component which is often being used for instrumenting .NET applications was able to handle anywhere between 2000 and 8500 trace events per second when event capture was enabled in the DebugView tool. <br /><img height="257" width="700" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/asgisv/WindowsLiveWriter/BestPracticesforInstrumentingHighPerform_A53C/TraceClassBenchmark_3.png" original-url="https://blogs.msdn.com/blogfiles/asgisv/WindowsLiveWriter/BestPracticesforInstrumentingHighPerform_A53C/TraceClassBenchmark_3.png" alt="TraceClassBenchmark" border="0" title="TraceClassBenchmark" style="display: inline; border-width: 0px;" />&nbsp;</div>
</li>
<li>
<div align="justify"><strong>Any changes in the tracing configuration such as enabling, disabling or changing the trace level required a restart of the BizTalk host instances.</strong> Although this doesn&rsquo;t impose any critical issues in the development or test environments, the need for application restart may be highly undesirable or even unacceptable in the production environment. </div>
</li>
</ul>
<h2>Solution</h2>
<p align="justify">Our proposed implementation leveraged the ETW infrastructure which enabled us to take advantage of the general purpose, high-speed tracing facility provided by the OS kernel. It turned out that we didn&rsquo;t have to write our own custom providers. During the analysis phase, we discovered what can be generally described as a hidden gem inside the BizTalk runtime engine called <em><strong>TraceProvider</strong></em> from the <em>Microsoft.BizTalk.Diagnostics</em> namespace in <em>Microsoft.BizTalk.Tracing.dll</em>. As things stand at the moment, this class has not as yet been fully documented despite that it is being extensively used virtually by all major infrastructure components inside the BizTalk runtime, including EPM, transport adapters, Message Agent, etc.</p>
<p align="justify">The <em>Microsoft.BizTalk.Diagnostics.TraceManager</em> class implements an ETW provider and exposes the following key properties and methods which have been leveraged in our prototype:</p>
<pre class="csharpcode"><span class="kwrd">namespace</span> Microsoft.BizTalk.Diagnostics
{
    [ComVisible(<span class="kwrd">true</span>)]
    [Guid(<span class="str">"748004CA-4959-409a-887C-6546438CF48E"</span>)]
    <span class="kwrd">public</span> <span class="kwrd">sealed</span> <span class="kwrd">class</span> TraceProvider
    {
        <span class="kwrd">public</span> TraceProvider(<span class="kwrd">string</span> applicationName, Guid controlGuid);

        <span class="kwrd">public</span> <span class="kwrd">uint</span> Flags { get; }
        <span class="kwrd">public</span> <span class="kwrd">bool</span> IsEnabled { get; }

        <span class="kwrd">public</span> <span class="kwrd">void</span> TraceMessage(<span class="kwrd">uint</span> traceFlags, <span class="kwrd">object</span> format);
        <span class="kwrd">public</span> <span class="kwrd">void</span> TraceMessage(<span class="kwrd">uint</span> traceFlags, <span class="kwrd">object</span> format, <span class="kwrd">object</span> data1);
        <span class="rem">// + a few more overloads of TraceMessage accepting extra data items.</span>
    }
}</pre>
<p>

</p>
<p align="justify">Below is the class diagram for the tracing framework:</p>
<p align="justify">&nbsp;<img height="481" width="700" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/38/83/metablogapi/8867.InstrumentationClassDiagramNew_187294CB.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-38-83-metablogapi/8867.InstrumentationClassDiagramNew_5F00_187294CB.png" alt="Instrumentation Class Diagram (New)" border="0" title="Instrumentation Class Diagram (New)" class="wlDisabledImage" style="display: inline; border-width: 0px;" /> </p>
<p>The key player in the tracing framework is the <em><strong>ComponentTraceProvider</strong></em> class which is simply acting as a wrapper for <em><strong>TraceProvider</strong> </em>and provides a richer choice of tracing methods for various types of events such as informational, warnings, errors and exceptions. We also added the support for tracing method calls, measuring durations using high-resolution timers and ability to correlate events using Guid-based tokens.</p>
<p align="justify">The <em><strong>ComponentTraceProvider</strong></em> class implements the following methods:</p>
<pre class="csharpcode"><span class="rem">// Writes an information message to the trace.</span>
<span class="kwrd">void</span> TraceInfo(<span class="kwrd">string</span> format, <span class="kwrd">params</span> <span class="kwrd">object</span>[] parameters);

<span class="rem">// Writes an information message to the trace. This method is provided for optimal performance when</span>
<span class="rem">// tracing simple messages which don't require a format string.</span>
<span class="kwrd">void</span> TraceInfo(<span class="kwrd">string</span> message);

<span class="rem">// Writes an information message to the trace. This method is intended to be used when the data that needs to be</span>
<span class="rem">// written to the trace is expensive to be fetched. The method represented by the Func&lt;T&gt; delegate will only be invoked if</span>
<span class="rem">// tracing is enabled.</span>
<span class="kwrd">void</span> TraceInfo(<span style="color: #008080;">Func</span>&lt;<span class="kwrd">string</span>&gt; expensiveDataProvider);

<span class="rem">// Writes a warning message to the trace.</span>
<span class="kwrd">void</span> TraceWarning(<span class="kwrd">string</span> format, <span class="kwrd">params</span> <span class="kwrd">object</span>[] parameters);

<span class="rem">// Writes a warning message to the trace. This method is provided for optimal performance when</span>
<span class="rem">// tracing simple messages which don't require a format string.</span>
<span class="kwrd">void</span> TraceWarning(<span class="kwrd">string</span> message);

<span class="rem">// Writes a message to the trace. This method can be used to trace detailed information</span>
<span class="rem">// which is only required in particular cases.</span>
<span class="kwrd">void</span> TraceDetails(<span class="kwrd">string</span> format, <span class="kwrd">params</span> <span class="kwrd">object</span>[] parameters);

<span class="rem">// Writes an error message to the trace.</span>
<span class="kwrd">void</span> TraceError(<span class="kwrd">string</span> format, <span class="kwrd">params</span> <span class="kwrd">object</span>[] parameters);

<span class="rem">// Writes an error message to the trace. This method is provided for optimal performance when</span>
<span class="rem">// tracing simple messages which don't require a format string.</span>
<span class="kwrd">void</span> TraceError(<span class="kwrd">string</span> message);

<span class="rem">// Writes the exception details to the trace.</span>
<span class="kwrd">void</span> TraceError(<span style="color: #008080;">Exception</span> ex);

<span class="rem">// Writes the exception details to the trace.</span>
<span class="kwrd">void</span> TraceError(<span style="color: #008080;">Exception</span> ex, <span class="kwrd">bool</span> includeStackTrace);

<span class="rem">// Writes the exception details to the trace.</span>
<span class="kwrd">void</span> TraceError(<span style="color: #008080;">Exception</span> ex, <span class="kwrd">bool</span> includeStackTrace, <span style="color: #008080;">Guid</span> callToken);

<span class="rem">// Writes an informational event into the trace log indicating that a method is invoked. This can be useful for tracing method calls to help analyze the </span>
<span class="rem">// code execution flow. The method will also write the same event into default System.Diagnostics trace listener, however this will only occur in the DEBUG code.</span>
<span class="rem">// A call to the TraceIn method would typically be at the very beginning of an instrumented code.</span>
<span style="color: #008080;">Guid</span> TraceIn(<span class="kwrd">params</span> <span class="kwrd">object</span>[] inParameters);

<span class="rem">// Writes an informational event into the trace log indicating that a method is invoked. This can be useful for tracing method calls to help analyze the </span>
<span class="rem">// code execution flow. The method will also write the same event into default System.Diagnostics trace listener, however this will only occur in the DEBUG code.</span>
<span class="rem">// A call to the TraceIn method would typically be at the very beginning of an instrumented code.</span>
<span class="rem">// This method is provided to ensure optimal performance when no parameters are required to be traced.</span>
<span style="color: #008080;">Guid</span> TraceIn();

<span class="rem">// Writes an informational event into the trace log indicating that a method is about to complete. This can be useful for tracing method calls to help analyze the </span>
<span class="rem">// code execution flow. The method will also write the same event into default System.Diagnostics trace listener, however this will only occur in the DEBUG code.</span>
<span class="rem">// A call to the TraceOut method would typically be at the very end of an instrumented code, before the code returns its result (if any).</span>
<span class="kwrd">void</span> TraceOut(<span class="kwrd">params</span> <span class="kwrd">object</span>[] outParameters);

<span class="rem">// Writes an informational event into the trace log indicating that a method is about to complete. This can be useful for tracing method calls to help analyze the </span>
<span class="rem">// code execution flow. The method will also write the same event into default System.Diagnostics trace listener, however this will only occur in the DEBUG code.</span>
<span class="rem">// A call to the TraceOut method would typically be at the very end of an instrumented code, before the code returns its result (if any).</span>
<span class="rem">// This method is provided to ensure optimal performance when no parameters are required to be traced.</span>
<span class="kwrd">void</span> TraceOut();

<span class="rem">// Writes an informational event into the trace log indicating that a method is about to complete. This can be useful for tracing method calls to help analyze the </span>
<span class="rem">// code execution flow. The method will also write the same event into default System.Diagnostics trace listener, however this will only occur in the DEBUG code.</span>
<span class="rem">// A call to the TraceOut method would typically be at the very end of an instrumented code, before the code returns its result (if any).</span>
<span class="kwrd">void</span> TraceOut(<span style="color: #008080;">Guid</span> callToken, <span class="kwrd">params</span> <span class="kwrd">object</span>[] outParameters);

<span class="rem">// Writes an informational event into the trace log indicating a start of a scope for which duration will be measured.</span>
<span class="kwrd">long</span> TraceStartScope(<span class="kwrd">string</span> scope, <span class="kwrd">params</span> <span class="kwrd">object</span>[] parameters);

<span class="rem">// Writes an informational event into the trace log indicating the start of a scope for which duration will be measured.</span>
<span class="rem">// This method is provided in order to ensure optimal performance when no parameters are available for tracing.</span>
<span class="kwrd">long</span> TraceStartScope(<span class="kwrd">string</span> scope);

<span class="rem">// Writes an informational event into the trace log indicating the start of a scope for which duration will be measured.</span>
<span class="rem">// This method is provided in order to ensure optimal performance when only 1 parameter of type Guid is available for tracing.</span>
<span class="kwrd">long</span> TraceStartScope(<span class="kwrd">string</span> scope, <span style="color: #008080;">Guid</span> callToken);

<span class="rem">// Writes an informational event into the trace log indicating the end of a scope for which duration will be measured.</span>
<span class="kwrd">void</span> TraceEndScope(<span class="kwrd">string</span> scope, <span class="kwrd">long</span> startTicks);

<span class="rem">// Writes an informational event into the trace log indicating the end of a scope for which duration will be measured.</span>
<span class="kwrd">void</span> TraceEndScope(<span class="kwrd">string</span> scope, <span class="kwrd">long</span> startTicks, <span style="color: #008080;">Guid</span> callToken);</pre>
<p align="justify">We implemented the ability to support instrumentation by a component type so that tracing can be enabled and disabled separately for custom pipeline components, orchestrations, maps, rules and so on. The <strong><em>TraceManager</em></strong> class exposes a static instance of <strong><em>ComponentTraceProvider</em> </strong>for each individual type of components as follows:</p>
<pre class="csharpcode"><span class="rem">/// The main tracing component which is intended to be invoked from user code.</span>
<span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">class</span> <span style="color: #008080;">TraceManager</span>
{
    <span class="preproc">#region</span> Private members
    <span class="kwrd">private</span> <span class="kwrd">static</span> <span style="color: #008080;">IComponentTraceProvider</span> pipelineComponentTracer = <span class="kwrd">new</span> <span style="color: #008080;">ComponentTraceProvider</span>(<span class="str"><span style="color: #800000;">"PipelineComponent"</span></span>, <span class="kwrd">new</span> <span style="color: #008080;">Guid</span>(<span class="str"><span style="color: #800000;">"691CB4CB-D20C-408e-8CFF-FD8A01CD2F75"</span></span>));
    <span class="kwrd">private</span> <span class="kwrd">static</span> <span style="color: #008080;">IComponentTraceProvider</span> workflowComponentTracer = <span class="kwrd">new</span> <span style="color: #008080;">ComponentTraceProvider</span>(<span class="str"><span style="color: #800000;">"WorkflowComponent"</span></span>, <span class="kwrd">new</span> <span style="color: #008080;">Guid</span>(<span class="str"><span style="color: #800000;">"D2316AFB-414B-42e4-BB7F-3AA92B96A98A"</span></span>));
    <span class="kwrd">private</span> <span class="kwrd">static</span> <span style="color: #008080;">IComponentTraceProvider</span> dataAccessComponentTracer = <span class="kwrd">new</span> <span style="color: #008080;">ComponentTraceProvider</span>(<span class="str"><span style="color: #800000;">"DataAccessComponent"</span></span>, <span class="kwrd">new</span> <span style="color: #008080;">Guid</span>(<span class="str"><span style="color: #800000;">"2E5D65D8-71F9-43e9-B477-733EF6212895"</span></span>));
    <span class="kwrd">private</span> <span class="kwrd">static</span> <span style="color: #008080;">IComponentTraceProvider</span> transformComponentTracer = <span class="kwrd">new</span> <span style="color: #008080;">ComponentTraceProvider</span>(<span class="str"><span style="color: #800000;">"TransformComponent"</span></span>, <span class="kwrd">new</span> <span style="color: #008080;">Guid</span>(<span class="str"><span style="color: #800000;">"226445A8-5AF3-4dbe-86D2-73E9B965378E"</span></span>));
    <span class="kwrd">private</span> <span class="kwrd">static</span> <span style="color: #008080;">IComponentTraceProvider</span> serviceComponentTracer = <span class="kwrd">new</span> <span style="color: #008080;">ComponentTraceProvider</span>(<span class="str"><span style="color: #800000;">"ServiceComponent"</span></span>, <span class="kwrd">new</span> <span style="color: #008080;">Guid</span>(<span class="str"><span style="color: #800000;">"E67E8346-90F1-408b-AF40-222B6E3C5ED6"</span></span>));
    <span class="kwrd">private</span> <span class="kwrd">static</span> <span style="color: #008080;">IComponentTraceProvider</span> customComponentTracer = <span class="kwrd">new</span> <span style="color: #008080;">ComponentTraceProvider</span>(<span class="str"><span style="color: #800000;">"CustomComponent"</span></span>, <span class="kwrd">new</span> <span style="color: #008080;">Guid</span>(<span class="str"><span style="color: #800000;">"6A223DEA-F806-4523-BAD0-312DCC4F63F9"</span></span>));
    <span class="kwrd">private</span> <span class="kwrd">static</span> <span style="color: #008080;">IComponentTraceProvider</span> rulesComponentTracer = <span class="kwrd">new</span> <span style="color: #008080;">ComponentTraceProvider</span>(<span class="str"><span style="color: #800000;">"RulesComponent"</span></span>, <span class="kwrd">new</span> <span style="color: #008080;">Guid</span>(<span class="str"><span style="color: #800000;">"78E2D466-590F-4991-9287-3F00BA62793D"</span></span>));
    <span class="kwrd">private</span> <span class="kwrd">static</span> <span style="color: #008080;">IComponentTraceProvider</span> trackingComponentTracer = <span class="kwrd">new</span> <span style="color: #008080;">ComponentTraceProvider</span>(<span class="str"><span style="color: #800000;">"TrackingComponent"</span></span>, <span class="kwrd">new</span> <span style="color: #008080;">Guid</span>(<span class="str"><span style="color: #800000;">"5CBD8BA0-60F8-401b-8FF5-C7F3D5FABE41"</span></span>));
    <span class="preproc">#endregion</span>

    <span class="preproc">#region</span> Public properties
    <span class="rem">// The trace provider for user code in the custom pipeline components.</span>
    <span class="kwrd">public</span> <span class="kwrd">static</span> <span style="color: #008080;">IComponentTraceProvider</span> PipelineComponent
    {
        get { <span class="kwrd">return</span> pipelineComponentTracer; }
    }

    <span class="rem">// The trace provider for user code in workflows (such as expression shapes in the BizTalk orchestrations).</span>
    <span class="kwrd">public</span> <span class="kwrd">static</span> <span style="color: #008080;">IComponentTraceProvider</span> WorkflowComponent
    {
        get { <span class="kwrd">return</span> workflowComponentTracer; }
    }

    <span class="rem">// The trace provider for user code in the custom components responsible for data access operations.</span>
    <span class="kwrd">public</span> <span class="kwrd">static</span> <span style="color: #008080;">IComponentTraceProvider</span> DataAccessComponent
    {
        get { <span class="kwrd">return</span> dataAccessComponentTracer; }
    }

    <span class="rem">// The trace provider for user code in the transformation components (such as scripting functoids in the BizTalk maps).</span>
    <span class="kwrd">public</span> <span class="kwrd">static</span> <span style="color: #008080;">IComponentTraceProvider</span> TransformComponent
    {
        get { <span class="kwrd">return</span> transformComponentTracer; }
    }

    <span class="rem">// The trace provider for user code in the service components (such as Web Service, WCF Service or service proxy components).</span>
    <span class="kwrd">public</span> <span class="kwrd">static</span> <span style="color: #008080;">IComponentTraceProvider</span> ServiceComponent
    {
        get { <span class="kwrd">return</span> serviceComponentTracer; }
    }

    <span class="rem">// The trace provider for user code in the Business Rules components (such as custom fact retrievers, policy executors).</span>
    <span class="kwrd">public</span> <span class="kwrd">static</span> <span style="color: #008080;">IComponentTraceProvider</span> RulesComponent
    {
        get { <span class="kwrd">return</span> rulesComponentTracer; }
    }

    <span class="rem">// The trace provider for user code in the business activity tracking components (such as BAM activities).</span>
    <span class="kwrd">public</span> <span class="kwrd">static</span> <span style="color: #008080;">IComponentTraceProvider</span> TrackingComponent
    {
        get { <span class="kwrd">return</span> trackingComponentTracer; }
    }

    <span class="rem">// The trace provider for user code in any other custom components which don't fall into any of the standard categories such as Pipeline, Workflow, DataAccess, Transform, Service or Rules.</span>
    <span class="kwrd">public</span> <span class="kwrd">static</span> <span style="color: #008080;">IComponentTraceProvider</span> CustomComponent
    {
        get { <span class="kwrd">return</span> customComponentTracer; }
    }
    <span class="preproc">#endregion</span>
}</pre>
<p>

</p>
<p align="justify">The new tracing framework has delivered the following benefits:</p>
<ul>
<li>
<div align="justify"><strong>Highest possible performance</strong> &ndash; our tests on a 3.2GHz Quad Core machine have proven that ETW-based tracing component is able to write about 1.4 million trace events per second; </div>
</li>
<li>
<div align="justify"><strong>No high CPU utilization</strong> observed whenever trace events are persisted into a log file. ETW is using a buffering and logging mechanism implemented in the kernel. The logging mechanism uses per-processor buffers that are written to disk by an asynchronous writer thread. This significantly reduces the impact of the log write operations on the application and system performance.</div>
</li>
<li>
<div align="justify"><strong>Full operational flexibility</strong> enables switching the tracing on and off as well as changing the trace level dynamically, making it easy to perform detailed tracing in production environments without requiring reboots or application restarts.</div>
</li>
<li>
<div align="justify"><strong>Tracing can be safely enabled to run continuously</strong> in a production environment using the circular logging option which ensures that log files will not outgrow the available disk space. </div>
</li>
</ul>
<h2>Performance Considerations</h2>
<p align="justify">When compared to the other 3 popular rivals (System.Diagnostic.Trace in the .NET Framework, log4net and Enterprise Library), the ETW-based implementation has demonstrated a significantly better performance. In order to measure the true extent of performance benefits delivered by the ETW-based component, we have created a fairly simple test scenario.</p>
<p align="justify">In our test case, we executed 1 instrumented method 100,000 times writing 1 trace event in each iteration. To make it fair for everyone, we configured all 4 benchmarked instrumentation frameworks to produce a text-based trace log file at the end of the test run.</p>
<p align="justify">Below are the results from our benchmarking exercise:</p>
<p align="justify"><img height="161" width="600" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/asgisv/WindowsLiveWriter/BestPracticesforInstrumentingHighPerform_A53C/p4_3.png" original-url="https://blogs.msdn.com/blogfiles/asgisv/WindowsLiveWriter/BestPracticesforInstrumentingHighPerform_A53C/p4_3.png" alt="p4" border="0" title="p4" style="display: inline; border-width: 0px;" /> </p>
<p align="justify"><img height="464" width="700" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/asgisv/WindowsLiveWriter/BestPracticesforInstrumentingHighPerform_A53C/p5_3.png" original-url="https://blogs.msdn.com/blogfiles/asgisv/WindowsLiveWriter/BestPracticesforInstrumentingHighPerform_A53C/p5_3.png" alt="p5" border="0" title="p5" style="display: inline; border-width: 0px;" /> </p>
<p align="justify">The code samples include a test tool which was used for benchmarking all 4 instrumentation frameworks. </p>
<h2>Usage Patterns</h2>
<p align="justify">The examples below illustrate the usage pattern for the tracing framework. This code fragment demonstrates the use of the <strong><em>TraceManager</em></strong> component for capturing 2 events indicating when method was invoked (<em>TraceIn</em>) and when it was completed (<em>TraceOut</em>).</p>
<pre class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">void</span> BeginAndCompleteActivity(<span style="color: #008080;">ActivityBase </span>activity)
{
    <span style="color: #008080;">Guard</span>.ArgumentNotNull(activity, <span class="str"><span style="color: #800000;">"activity"</span></span>);

    <span style="color: #0000ff;">var</span> callToken = <span style="color: #008080;">TraceManager</span>.<span style="color: #008080;">TrackingComponent</span>.<span style="color: #ff0000;"><strong>TraceIn</strong></span>(activity.ActivityName, activity.ActivityID);

    <span class="kwrd">this</span>.eventStream.BeginActivity(activity.ActivityName, activity.ActivityID);
    <span class="kwrd">this</span>.eventStream.UpdateActivity(activity.ActivityName, activity.ActivityID, ActivityTrackingUtility.GetActivityData(activity));
    <span class="kwrd">this</span>.eventStream.EndActivity(activity.ActivityName, activity.ActivityID);

    <span style="color: #008080;">TraceManager</span>.<span style="color: #008080;">TrackingComponent</span>.<span style="color: #ff0000;"><strong>TraceOut</strong></span>(callToken);
}</pre>
<p>

</p>
<p align="justify">When enabled, the trace log will contain both events written with a timestamp along with a call correlation token (callToken) which enables to match both <em>TraceIn</em> and <em>TraceOut</em> events together:</p>
<p align="justify"><img height="257" width="700" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/asgisv/WindowsLiveWriter/BestPracticesforInstrumentingHighPerform_A53C/Tracing%20Log%20Sample_3.png" original-url="https://blogs.msdn.com/blogfiles/asgisv/WindowsLiveWriter/BestPracticesforInstrumentingHighPerform_A53C/Tracing%20Log%20Sample_3.png" alt="Tracing Log Sample" border="0" title="Tracing Log Sample" style="display: inline; border-width: 0px;" /> </p>
<p align="justify">The following sections drill down into specific instrumentation scenarios across the entire family of artifacts and building blocks in a BizTalk solution.</p>
<h2>Instrumentation of Custom Pipeline Components</h2>
<p align="justify">The custom pipeline components can be instrumented using <strong><em>TraceManager.PipelineComponent</em></strong> which is dedicated for this type of BizTalk artifacts. Some of the useful events to be captured through the code instrumentation may include:</p>
<ul>
<li>
<div align="justify">Tracing calls to the core methods such as <em><strong><a target="_blank" href="https://msdn.microsoft.com/en-us/library/microsoft.biztalk.component.interop.icomponent.execute(BTS.10).aspx">Execute</a></strong></em>, <em><strong><a target="_blank" href="https://msdn.microsoft.com/en-us/library/microsoft.biztalk.component.interop.idisassemblercomponent.disassemble(BTS.10).aspx">Disassemble</a></strong></em>, <em><strong><a target="_blank" href="https://msdn.microsoft.com/en-us/library/microsoft.biztalk.component.interop.idisassemblercomponent.getnext(BTS.10).aspx">GetNext</a></strong></em>, etc. (using <em>TraceIn</em> and <em>TraceOut</em>);</div>
</li>
<li>
<div align="justify">Measuring duration of the above methods (using <em>TraceStartScope</em> and <em>TraceEndScope</em>);</div>
</li>
<li>
<div align="justify">Tracing the internal state of pipeline components which could in turn assist with troubleshooting (using <em>TraceInfo</em>);</div>
</li>
<li>
<div align="justify">Writing detailed information about a runtime exception (using <em>TraceError</em>).</div>
</li>
</ul>
<p align="justify">Below is an example of some of the techniques highlighted above:</p>
<p><img height="607" width="700" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/asgisv/WindowsLiveWriter/BestPracticesforInstrumentingHighPerform_A53C/Instrumenting%20Custom%20Pipeline%20Components%20Sample_3.png" original-url="https://blogs.msdn.com/blogfiles/asgisv/WindowsLiveWriter/BestPracticesforInstrumentingHighPerform_A53C/Instrumenting%20Custom%20Pipeline%20Components%20Sample_3.png" alt="Instrumenting Custom Pipeline Components Sample" border="0" title="Instrumenting Custom Pipeline Components Sample" style="display: inline; border-width: 0px;" /></p>
<h2>Instrumentation of BizTalk Maps</h2>
<p align="justify">The BizTalk maps can be instrumented using <strong><em>TransformTraceManager</em></strong> component which can be invoked from inside a <a target="_blank" href="https://msdn.microsoft.com/en-us/library/aa561729(v=BTS.70).aspx">custom scripting functoid</a> associated with an external assembly. Some useful events that can be captured from the maps when they are being executed by the BizTalk runtime engine may include:</p>
<ul>
<li>
<div align="justify">Tracing the invocation of XSLT templates implementing the BizTalk maps (using <em>TraceIn</em> and <em>TraceOut</em>);</div>
</li>
<li>
<div align="justify">Tracing the internal state of maps, e.g. the node values which are being transformed, which could in turn assist with troubleshooting (using <em>TraceInfo</em>).</div>
</li>
</ul>
<p align="justify"><span style="font-family: Segoe UI Semibold; color: #3a3e43;">In the example below, the instrumented map is using the <em>TraceInfo</em> method to report the values of the <em>GSxx</em> nodes in the input document:</span></p>
<p align="justify"><span style="font-family: segoe ui semibold; color: #3a3e43;">&nbsp;</span></p>
<p align="justify"><img height="376" width="700" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/38/83/metablogapi/2526.Maptracingnodevalues_0CDCD78C.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-38-83-metablogapi/2526.Maptracingnodevalues_5F00_0CDCD78C.png" alt="Map tracing node values" border="0" title="Map tracing node values" class="wlDisabledImage" style="display: inline; border-width: 0px;" /></p>
<p align="justify">Note that BizTalk maps cannot invoke static methods from an external assembly by design. Consequently, there is a separate non-static class (<em><strong>TransformTraceManager</strong></em>) that is responsible for relaying method calls between a map and the statically initialized singleton <strong><em>TraceManager.TransformComponent</em></strong> object.</p>
<p align="justify">When adding instrumentation into BizTalk maps, it&rsquo;s important to have the custom scripting functoids linked to appropriate nodes in the output document, otherwise the scripting code will be omitted from the auto-generated XSLT template. In the above example, all scripting functoids are connected to the root node in the output document via a helper <a target="_blank" href="https://msdn.microsoft.com/en-us/library/aa560272(v=BTS.10).aspx">Logical OR functoid</a>. This ensures that tracing takes place right before creating the root XML element and results in generating the following XSLT code by the BizTalk mapper:</p>
<pre class="csharpcode"><span class="rem">&lt;!-- There is some XSLT code before this element --&gt;</span>
<span class="kwrd">&lt;</span><span class="html">xsl:template</span> <span class="attr">match</span><span class="kwrd">="/s2:CSC_837D"</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">xsl:variable</span> <span class="attr">name</span><span class="kwrd">="var:v1"</span> <span class="attr">select</span><span class="kwrd">="ScriptNS0:TraceInfo(string(s0:Headers/s0:GS/s0:GS01/text()))"</span> <span class="kwrd">/&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">xsl:variable</span> <span class="attr">name</span><span class="kwrd">="var:v2"</span> <span class="attr">select</span><span class="kwrd">="ScriptNS0:TraceInfo(string(s0:Headers/s0:GS/s0:GS02/text()))"</span> <span class="kwrd">/&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">xsl:variable</span> <span class="attr">name</span><span class="kwrd">="var:v3"</span> <span class="attr">select</span><span class="kwrd">="ScriptNS0:TraceInfo(string(s0:Headers/s0:GS/s0:GS03/text()))"</span> <span class="kwrd">/&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">xsl:variable</span> <span class="attr">name</span><span class="kwrd">="var:v4"</span> <span class="attr">select</span><span class="kwrd">="ScriptNS0:TraceInfo(string(s0:Headers/s0:GS/s0:GS04/text()))"</span> <span class="kwrd">/&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">xsl:variable</span> <span class="attr">name</span><span class="kwrd">="var:v5"</span> <span class="attr">select</span><span class="kwrd">="ScriptNS0:TraceInfo(string(s0:Headers/s0:GS/s0:GS05/text()))"</span> <span class="kwrd">/&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">xsl:variable</span> <span class="attr">name</span><span class="kwrd">="var:v6"</span> <span class="attr">select</span><span class="kwrd">="ScriptNS0:TraceInfo(string(s0:Headers/s0:GS/s0:GS06/text()))"</span> <span class="kwrd">/&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">xsl:variable</span> <span class="attr">name</span><span class="kwrd">="var:v7"</span> <span class="attr">select</span><span class="kwrd">="ScriptNS0:TraceInfo(string(s0:Headers/s0:GS/s0:GS07/text()))"</span> <span class="kwrd">/&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">xsl:variable</span> <span class="attr">name</span><span class="kwrd">="var:v8"</span> <span class="attr">select</span><span class="kwrd">="ScriptNS0:TraceInfo(string(s0:Headers/s0:GS/s0: GS08/text()))"</span> <span class="kwrd">/&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">xsl:variable</span> <span class="attr">name</span><span class="kwrd">="var:v9"</span> <span class="attr">select</span><span class="kwrd">="userCSharp:LogicalOr(string($var:v1), &rsquo;true&rsquo;, string($var:v2), string($var:v3), string($var:v4), string($var:v5), string($var:v6), string($var:v7), string($var:v8))"</span> <span class="kwrd">/&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">xsl:if</span> <span class="attr">test</span><span class="kwrd">="$var:v9"</span><span class="kwrd">&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">ns0:W4880200-COMMON-EDIT-MED-CLAIM</span><span class="kwrd">&gt;</span>
      <span class="rem">&lt;!-- There is plenty of other XSLT code after this element --&gt;</span></pre>
<h2>Instrumentation of BizTalk Orchestrations</h2>
<p align="justify">As BizTalk orchestrations become increasingly complex, the instrumentation is becoming a key factor in helping to diagnose and troubleshoot behavioral problems, performance-related issues and other bottlenecks that were not foreseen or manifested themselves during development.</p>
<p align="justify">A well instrumented orchestration can be described as follows:</p>
<ul>
<li>
<div align="justify">The entry point into an orchestration is recorded (using <em>TraceIn)</em> immediately or at least at the first available opportunity (e.g. after the very first <em>Receive</em> shape<em>);</em></div>
</li>
<li>
<div align="justify">The internal state of orchestrations (e.g. variables, results from method calls, non-sensitive message payload) is wisely traced (using <em>TraceInfo</em>);</div>
</li>
<li>
<div align="justify">Unexpected behavior is reported as soon as it is detected (using <em>TraceWarning</em> or <em>TraceError</em>);</div>
</li>
<li>
<div align="justify">The detailed information about a runtime exception is traced from inside the exception handling block (using <em>TraceError</em>);</div>
</li>
<li>
<div align="justify">The duration of individual scopes or/and entire orchestration is measured and traced (using <em>TraceStartScope</em> and <em>TraceEndScope</em>);</div>
</li>
<li>
<div align="justify">The exit point from an orchestration is recorded (using <em>TraceOut) </em>either right before the <em>Terminate</em> shape or at the very last step in the orchestration.</div>
</li>
</ul>
<p align="justify">Below are some example of the instrumentation techniques highlighted above:</p>
<p align="justify"><img height="277" width="700" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/asgisv/WindowsLiveWriter/BestPracticesforInstrumentingHighPerform_A53C/Tracing%20Orch%20Entry%20Point_3.png" original-url="https://blogs.msdn.com/blogfiles/asgisv/WindowsLiveWriter/BestPracticesforInstrumentingHighPerform_A53C/Tracing%20Orch%20Entry%20Point_3.png" alt="Tracing Orch Entry Point" border="0" title="Tracing Orch Entry Point" style="display: inline; border-width: 0px;" /> </p>
<p align="justify"><img height="344" width="700" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/asgisv/WindowsLiveWriter/BestPracticesforInstrumentingHighPerform_A53C/Tracing%20Orch%20Info%20and%20Warnings_3.png" original-url="https://blogs.msdn.com/blogfiles/asgisv/WindowsLiveWriter/BestPracticesforInstrumentingHighPerform_A53C/Tracing%20Orch%20Info%20and%20Warnings_3.png" alt="Tracing Orch Info and Warnings" border="0" title="Tracing Orch Info and Warnings" style="display: inline; border-width: 0px;" /> </p>
<p align="justify"><img height="359" width="700" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/asgisv/WindowsLiveWriter/BestPracticesforInstrumentingHighPerform_A53C/Tracing%20Orch%20Exceptions_3.png" original-url="https://blogs.msdn.com/blogfiles/asgisv/WindowsLiveWriter/BestPracticesforInstrumentingHighPerform_A53C/Tracing%20Orch%20Exceptions_3.png" alt="Tracing Orch Exceptions" border="0" title="Tracing Orch Exceptions" style="display: inline; border-width: 0px;" /></p>
<p align="justify">&nbsp;<img height="278" width="695" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/33/60/metablogapi/2818.TracingOrchStartEndScope_1BA0CD10.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-33-60-metablogapi/2818.TracingOrchStartEndScope_5F00_1BA0CD10.png" alt="Tracing Orch Start &amp; End Scope" border="0" title="Tracing Orch Start &amp; End Scope" style="display: inline; border-width: 0px;" /> </p>
<p align="justify"><img height="225" width="700" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/asgisv/WindowsLiveWriter/BestPracticesforInstrumentingHighPerform_A53C/Tracing%20Orch%20Exit%20Point_3.png" original-url="https://blogs.msdn.com/blogfiles/asgisv/WindowsLiveWriter/BestPracticesforInstrumentingHighPerform_A53C/Tracing%20Orch%20Exit%20Point_3.png" alt="Tracing Orch Exit Point" border="0" title="Tracing Orch Exit Point" style="display: inline; border-width: 0px;" />&nbsp; </p>
<h2>Instrumentation of Business Rules</h2>
<p align="justify">The instrumentation of business rules can be extremely valuable when there is a requirement to understand how rule conditions are being evaluated, what rules are being fired as well as how long it takes to execute a rule set (policy). </p>
<p align="justify">A well instrumented business rule policy can be defined as follows:</p>
<ul>
<li>
<div align="justify">All calls to a helper class invoking the BRE APIs (such as <strong><em><a target="_blank" href="https://technet.microsoft.com/en-us/library/microsoft.ruleengine.policy(BTS.10).aspx">Policy</a></em></strong> objects) are traced (using <em>TraceIn</em> and <em>TraceOut</em>);</div>
</li>
<li>
<div align="justify">The duration of policy execution is recorded (using <em>TraceStartScope</em> and <em>TraceEndScope</em>);</div>
</li>
<li>
<div align="justify">The BRE policies are invoked passing an instance of a class implementing the <strong><em><a target="_blank" href="https://technet.microsoft.com/en-us/library/microsoft.ruleengine.irulesettrackinginterceptor(BTS.10).aspx">IRuleSetTrackingInterceptor</a></em></strong> interface - this class should report on all significant events which occur during policy execution;</div>
</li>
<li>
<div align="justify">Each rule in the policy informs the instrumentation framework that the rules was fired by the BRE engine (using either <em>TraceInfo, TraceWarning</em> or <em>TraceError</em>).</div>
</li>
</ul>
<p>The business rules instrumentation is powered by 3 components in our framework:</p>
<ul>
<li>
<div align="justify"><strong><em>TraceManager.RulesComponent</em></strong> provides general instrumentation methods for all helper .NET components accessing the BRE APIs;</div>
</li>
<li>
<div align="justify"><em><strong>RuleTraceManager</strong></em> residing in the <em>Microsoft.BizTalk.CAT.BestPractices.Framework.RulesEngine</em> namespace implements a static class which is intended to be used on the Action pane inside the Business Rule Composer. Its main purpose is to expose a set of tracing methods with a fixed parameter list. Internally, the <strong><em>RuleTraceManager </em></strong>is simply proxying all calls to <strong><em>TraceManager.RulesComponent</em></strong>. A requirement for a separate class has arisen from the fact that the Business Rules Engine doesn&rsquo;t currently support the invocation of methods with a variable number of parameters (also known as <a target="_blank" href="https://msdn.microsoft.com/en-us/library/aa645765(v=VS.71).aspx">parameter arrays</a>);</div>
</li>
<li>
<div align="justify"><strong><em>TracingRuleTrackingInterceptor</em></strong> which is also available in the <em>Microsoft.BizTalk.CAT.BestPractices.Framework.RulesEngine</em> namespace provides a custom implementation of the <a target="_blank" href="https://technet.microsoft.com/en-us/library/microsoft.ruleengine.irulesettrackinginterceptor(BTS.10).aspx"><strong><em>IRuleSetTrackingInterceptor</em></strong></a> interface. All events which occur during policy execution will be traced using <strong><em>TraceManager.RulesComponent</em></strong>. </div>
</li>
</ul>
<p>The following recommendations would apply in the context of business rules instrumentation:</p>
<ul>
<li>
<div align="justify">When calling any static methods from inside the business rules, make sure that <strong><em><a target="_blank" href="https://msdn.microsoft.com/en-us/library/aa548008(BTS.10).aspx">StaticSupport</a></em></strong> parameter is present either in the application&rsquo;s configuration file (e.g. <em>BTSNTSvc.exe.config</em>)&nbsp; or system registry. Otherwise, the <a target="_blank" href="https://blogs.msdn.com/asgisv/archive/2010/04/29/troubleshooting-bre-policies-failing-to-return-results.aspx">following behavior may be encountered</a>; </div>
</li>
<li>
<div align="justify">Consider adding a <em>TraceInfo</em> instrumentation event into each individual rule to facilitate the analysis of rule execution without having to analyze all events reported by the Rules Engine through <strong><em>TracingRuleTrackingInterceptor</em></strong>;</div>
</li>
<li>
<div align="justify">In addition to <em>TraceInfo,</em>&nbsp;<em>TraceWarning</em> and <em>TraceError</em> can be wisely applied at individual rule level in order to report on unexpected fact values or rules that are not expected to have been executed for a given set of facts.</div>
</li>
</ul>
<p>Below are some example of the approaches highlighted above:</p>
<p><img height="229" width="500" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/asgisv/WindowsLiveWriter/BestPracticesforInstrumentingHighPerform_A53C/TraceInfo%20event%20informs%20that%20this%20rule%20was%20fired%20by%20BRE_6.png" original-url="https://blogs.msdn.com/blogfiles/asgisv/WindowsLiveWriter/BestPracticesforInstrumentingHighPerform_A53C/TraceInfo%20event%20informs%20that%20this%20rule%20was%20fired%20by%20BRE_6.png" alt="TraceInfo event informs that this rule was fired by BRE" border="0" title="TraceInfo event informs that this rule was fired by BRE" style="display: inline; border-width: 0px;" /> <br /><img height="219" width="700" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/asgisv/WindowsLiveWriter/BestPracticesforInstrumentingHighPerform_A53C/TraceError%20event%20reports%20on%20unexpected%20fact%20value_3.png" original-url="https://blogs.msdn.com/blogfiles/asgisv/WindowsLiveWriter/BestPracticesforInstrumentingHighPerform_A53C/TraceError%20event%20reports%20on%20unexpected%20fact%20value_3.png" alt="TraceError event reports on unexpected fact value" border="0" title="TraceError event reports on unexpected fact value" style="display: inline; border-width: 0px;" /> <br /><img height="484" width="700" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/asgisv/WindowsLiveWriter/BestPracticesforInstrumentingHighPerform_A53C/BRE%20Policy%20Instrumentation%20Example_6.png" original-url="https://blogs.msdn.com/blogfiles/asgisv/WindowsLiveWriter/BestPracticesforInstrumentingHighPerform_A53C/BRE%20Policy%20Instrumentation%20Example_6.png" alt="BRE Policy Instrumentation Example" border="0" title="BRE Policy Instrumentation Example" style="display: inline; border-width: 0px;" /></p>
<h2>Instrumentation of Custom Components</h2>
<p align="justify">The custom .NET components can be instrumented by invoking the trace methods provided by <strong><em>TraceManager.CustomComponent </em></strong>which enables:</p>
<ul>
<li>
<div align="justify">Method-level instrumentation whereby calls to individual methods are recorded in the trace log with zero or more optional parameters (using <em>TraceIn</em> and <em>TraceOut</em>);</div>
</li>
<li>
<div align="justify">Measuring duration to be able to capture accurate execution timings (using <em>TraceStartScope</em> and <em>TraceEndScope</em>);</div>
</li>
<li>
<div align="justify">Tracing the internal state of custom components which could in turn assist with troubleshooting (using <em>TraceInfo</em> or<em> TraceWarning</em>);</div>
</li>
<li>
<div align="justify">Writing detailed information about a runtime exception (using <em>TraceError</em>).</div>
</li>
</ul>
<p align="justify">Below is an example of some of the techniques highlighted above:</p>
<p align="justify"><img height="435" width="700" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/asgisv/WindowsLiveWriter/BestPracticesforInstrumentingHighPerform_A53C/p6_6.png" original-url="https://blogs.msdn.com/blogfiles/asgisv/WindowsLiveWriter/BestPracticesforInstrumentingHighPerform_A53C/p6_6.png" alt="p6" border="0" title="p6" style="display: inline; border-width: 0px;" />&nbsp; <br /><strong>Show me the code! </strong>You can find the source code in the attachment below. Please share your feedback to help improve the instrumentation samples.</p>
<p align="justify"><span style="text-decoration: underline;"><span style="color: #800080;"><a href="https://archive.msdn.microsoft.com/Project/Download/FileDownload.aspx?ProjectName=appfabriccat&amp;DownloadId=11614"><strong>Best Practices for Instrumenting High Performance BizTalk Solutions.zip</strong></a></span></span><span style="text-decoration: underline;"><span style="color: #800080;">&nbsp;</span></span></p>
<p>For more information on the related topic, please visit the following resources: </p>
<ul>
<li>&ldquo;<a target="_blank" href="https://msdn.microsoft.com/en-us/magazine/cc163437.aspx">Improve Debugging And Performance Tuning With ETW</a>&rdquo; article in the MSDN Magazine </li>
<li>&ldquo;<a target="_blank" href="https://blogs.msdn.com/matt_pietrek/archive/2004/09/16/230700.aspx">Intro to Event Tracing For Windows</a>&rdquo; post on Matt Pietrek&rsquo;s blog </li>
</ul>
<p><img height="1" width="1" src="https://blogs.msdn.com/aggbug.aspx?PostID=10011185" /></p>]]></content:encoded>
    </item>
    <item>
      <title>Collecting Business Values from AppFabric for Analytics</title>
      <link>https://docs.microsoft.com/archive/blogs/asgisv/collecting-business-values-from-appfabric-for-analytics</link>
      <pubDate>Tue, 11 May 2010 05:15:00 GMT</pubDate>
      <dc:creator><![CDATA[ValeryM]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/asgisv/2010/05/11/collecting-business-values-from-appfabric-for-analytics/</guid>
      <description><![CDATA[Synopsis: Persistence Store extensibility to store and query metadata relating to workflow instances...]]></description>
      <content:encoded><![CDATA[<p align="justify">Synopsis: Persistence Store extensibility to store and query metadata relating to workflow instances - useful to generate IT and Business Reports from<em> Workflow Services</em> hosted within <em>Windows Server AppFabric - <a title="https://msdn.microsoft.com/en-us/windowsserver/ee695849.aspx" href="https://msdn.microsoft.com/en-us/windowsserver/ee695849.aspx" mce_href="https://msdn.microsoft.com/en-us/windowsserver/ee695849.aspx">https://msdn.microsoft.com/en-us/windowsserver/ee695849.aspx</a>. </em></p>  <p align="justify">The ability to report <i>Workflow Process</i> tracking status to end users is a very important feature of any Business Process Management (BPM) product, especially ones that run tens of thousands of concurrent processes. Many ISV partners have created their own tracking service, at great cost, that tracks metadata about the <i>Workflow Process</i> and each activity within it. This data is then presented via an UI status dialog for a selected <i>process instance</i>. A typical use of the <i>Workflow Process</i> tracking information is presented in the graphic below. </p>  <p align="justify"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/asgisv/WindowsLiveWriter/CollectingBusinessValuesfromAppFabricfor_631A/image_3c838c93-1826-4e35-bb19-187ebd3d9496.png" original-url="https://blogs.msdn.com/blogfiles/asgisv/WindowsLiveWriter/CollectingBusinessValuesfromAppFabricfor_631A/image_3c838c93-1826-4e35-bb19-187ebd3d9496.png" width="333" height="444" mce_src="https://blogs.msdn.com/blogfiles/asgisv/WindowsLiveWriter/CollectingBusinessValuesfromAppFabricfor_631A/image_3c838c93-1826-4e35-bb19-187ebd3d9496.png" /> </p>  <p align="justify" mce_keep="true">&#160;</p>  <p>A key feature of this tracking data is that it also includes some elements of the business data relating to the <i>Workflow Instance</i>. This allows ISV and Enterprise developers to provide some business contextual information along with the <i>Workflow Process </i>metadata. As you can see in the above status dialog the UI displays the client name and code as well as the user who initiated the process/<i>Workflow</i> and the users associated with completed manual tasks. </p>  <p>This blog post provides guidance on using <i>Promoted Properties</i> to generate reports that are of interest to business analysts and ITAdmins. The <i>Promoted Properties (new in .NET4) </i>are extensions supported by .NET4 <i>Workflow Services</i> hosted within AppFabric.</p>  <p align="justify" mce_keep="true">&#160;</p>  <h2>&#160;</h2>  <h2>Scenario</h2>  <p align="justify">Consider the typical scenario where an ISV or Enterprise IT Group develops or extends a dashboard to display the metrics around active business processes which are manifested as Workflow Services executing as an AppFabric application. In our scenario, the Workflow Service is implemented as an application that handles document format (e.g., *.docx to *.pdf) conversion. While the IT Group is interested in monitoring bottlenecks based off average processing time of the processes; the Business Analysts could be interested in the types and counts thereof. The graphic below is a typical representation of the data that addresses the needs of this scenario.&#160;&#160; </p>  <p align="justify"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image002" border="0" alt="clip_image002" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/asgisv/WindowsLiveWriter/CollectingBusinessValuesfromAppFabricfor_631A/clip_image002_15c39970-2e08-4e0e-a68b-842c515abec2.jpg" original-url="https://blogs.msdn.com/blogfiles/asgisv/WindowsLiveWriter/CollectingBusinessValuesfromAppFabricfor_631A/clip_image002_15c39970-2e08-4e0e-a68b-842c515abec2.jpg" width="590" height="294" mce_src="https://blogs.msdn.com/blogfiles/asgisv/WindowsLiveWriter/CollectingBusinessValuesfromAppFabricfor_631A/clip_image002_15c39970-2e08-4e0e-a68b-842c515abec2.jpg" /></p>  <p align="justify">While data relating to metrics is super useful from the Business and ITAdmin perspective, it’s not available via the tracked events emitted from Workflow Services. The challenge here is to generate data relating to the state of each running Workflow Instance, capture it in the AppFabric persistence database and generate a report of it. The next few sections of this blog post will discuss a few options to capture this data and describe one preferred approach in detail.&#160; </p>  <h2>&#160;</h2>  <h2>Traditional Methods </h2>  <p mce_keep="true">&#160;</p>  <p align="justify">The traditional methods to capture and report the state and other such data relating to the state of the Workflow Instances areeither<em> Custom Tracking Records</em> or <em>Extracted Variables</em>. </p>  <p align="justify">In the <em>Custom Tracking Record</em> approach, the ‘interesting’ data/record is written to the monitoring database when a <em>Workflow Activity</em> executes and consequently emits the custom record. In the <em>Extracted Variable</em> approach, the value is captured in the Monitoring database when a <em>Workflow Activity</em> enters a certain pre-configured state. While both are valid options, they have a common limitation – the values are emitted as part of the Workflow Service Monitoring infrastructure and therefore can be out of sync with the persisted state of a Workflow Service instance. To elaborate this limitation, consider the use case wherein after executing the <em>Workflow Activity,</em> the data is emitted (as a custom tracking record or triggered variable extraction). Next, the in-flight <em>Workflow Service Instance</em> is abandoned or aborted due to an exception which in turn causes a rollback (of the <em>Workflow Service Instance) </em>to the previous persistence point. Meanwhile, the state and other data relating to the ‘rolled back’ <em>Workflow Service Instance </em>are already written to the Monitoring database and are out of synch with the actual state of the <em>Workflow Service Instance</em>. Solutions using the monitoring store for state information relating to the <em>Workflow Service Instance and </em>will not yield accurate reports – a limitation in .NET3.5 version.</p>  <h2>New in .NET4/Windows Server AppFabric: Promoted Properties</h2>  <p align="justify"><em></em></p>  <p align="justify"><em>Promoted Properties </em>eliminates the consistency and sync issues we encounter in the traditional approaches, because the data is written or updated directly in the persistence database when the state of the <em>Workflow Service Instance </em>is updated. <em>Promoted Properties</em> are a set of properties that are maintained at the persistence points of a <em>Workflow Service</em>. Via this feature- <em>Promoted Properties, </em>as the name implies, the <em>Workflow Service Host</em> can “promote” a set of data - up to 64 variables, that is of interest to the scenario. The values for these <em>Promoted Properties</em> are written to the <i>System.Activities.DurableInstancing.InstancePromotedPropertiesTable</i> and can be queried from the <i>InstancePromotedProperties</i> view in the AppFabric Persistence Database. </p>  <p align="justify">The graphic below is an example of the query results from the <i>InstancePromotedProperties</i> view:</p>  <p align="justify"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image004" border="0" alt="clip_image004" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/asgisv/WindowsLiveWriter/CollectingBusinessValuesfromAppFabricfor_631A/clip_image004_08fbcca2-d8a8-4cc5-934d-2eff2b19d149.jpg" original-url="https://blogs.msdn.com/blogfiles/asgisv/WindowsLiveWriter/CollectingBusinessValuesfromAppFabricfor_631A/clip_image004_08fbcca2-d8a8-4cc5-934d-2eff2b19d149.jpg" width="590" height="60" mce_src="https://blogs.msdn.com/blogfiles/asgisv/WindowsLiveWriter/CollectingBusinessValuesfromAppFabricfor_631A/clip_image004_08fbcca2-d8a8-4cc5-934d-2eff2b19d149.jpg" /></p>  <p align="justify" mce_keep="true">&#160;</p>  <p>The <em>Promoted Properties</em> structure is not normalized and has columns: <em>Value1</em> through <em>Value64,</em> corresponding to the <em>InstanceId </em>and the <em>PromotionName</em> that labels the set of properties. No column names are stored for these values, so it is up to the consuming/reporting application to correctly interpret these columns. Furthermore, there is only one row of <em>Promoted Properties</em> for each <em>Workflow Service Instance.</em> This means that the values are inserted once and thereafter updated for every ‘p<em>ersistence’</em> of the associated <em>Workflow Service Instance - </em>this is a very important point to consider while designing the reporting application, especially if data relating to previous states is important. One shortcoming of the <em>Promoted Properties </em>feature is that they have no representation in the extensions to the IIS Manager User Interface that Windows Server AppFabric provides – a custom application is the only way to leverage this very useful feature. </p>  <p>Final consideration is that the <em>Promoted Properties</em> are a feature of the SQL Workflow Instance Store, and so may not be available if the AppFabric installation is using a custom provider for <em>Persistence</em>.</p>  <h2>Using Promoted Properties</h2>  <p align="justify">Using <em>Promoted Properties </em>is quite straightforward and this section elaborates on using this very interesting feature.&#160; </p>  <h3>&#160;</h3>  <h3>Configuring the <em>SqlWorkflowInstanceStoreBehavior</em></h3>  <p align="justify">The <em>SqlWorkflowInstanceStoreBehavior</em> defines a <em>Promote</em> method through which you define the schema of the values you wish to track. This behavior must be configured when a <em>Workflow Service Host</em> is being loaded for the Service (e.g., before it is opened). In order to accomplish this, you need to define a custom behavior whose sole purpose is to register your <em>Promoted Properties</em>. The following class shows an example of such a behavior that can be modified for the specific projects needs:</p>  <div align="justify">   <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">     <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">       <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> public class PromotePropertiesBehavior : IServiceBehavior</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     XNamespace xNS = XNamespace.Get(<span style="color: #006080">&quot;https://samples.com/CustomProperties&quot;</span>)<span style="color: #008000">;</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span> <span style="color: #008000"></span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span> <span style="color: #008000">    public virtual void AddBindingParameters(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase, Collection&lt;ServiceEndpoint&gt; endpoints, BindingParameterCollection bindingParameters)</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>     {</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>     }</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>&#160; </pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span>     public virtual void ApplyDispatchBehavior(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase)</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span>     {</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11">  11:</span>         WorkflowServiceHost host = serviceHostBase as WorkflowServiceHost<span style="color: #008000">;</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum12">  12:</span> <span style="color: #008000">        if (host != null)</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum13">  13:</span>         {</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum14">  14:</span>             SqlWorkflowInstanceStoreBehavior store = host.Description.Behaviors[typeof(SqlWorkflowInstanceStoreBehavior)] as SqlWorkflowInstanceStoreBehavior<span style="color: #008000">;</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum15">  15:</span> <span style="color: #008000"></span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum16">  16:</span> <span style="color: #008000">            if (store != null)</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum17">  17:</span>             {</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum18">  18:</span>                 List&lt;<span style="color: #008000">;XName&gt; variantProperties = new List&lt;XName&gt;()</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum19">  19:</span>                 {   </pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum20">  20:</span>                     xNS.GetName(<span style="color: #006080">&quot;ConvertFrom&quot;</span>),</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum21">  21:</span>                     xNS.GetName(<span style="color: #006080">&quot;ConvertTo&quot;</span>),</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum22">  22:</span>                     xNS.GetName(<span style="color: #006080">&quot;StartOrComplete&quot;</span>),</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum23">  23:</span>                     xNS.GetName(<span style="color: #006080">&quot;LastPropUpdateDateTime&quot;</span>),</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum24">  24:</span>                     xNS.GetName(<span style="color: #006080">&quot;Duration&quot;</span>)</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum25">  25:</span>                 }<span style="color: #008000">;</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum26">  26:</span> <span style="color: #008000"></span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum27">  27:</span> <span style="color: #008000">                store.Promote(&quot;ConversionStats&quot;, variantProperties, null);</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum28">  28:</span>&#160; </pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum29">  29:</span>                 host.WorkflowExtensions.Add&lt;<span style="color: #008000">;CustomPropertiesParticipant&gt;(() =&gt; new CustomPropertiesParticipant());</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum30">  30:</span>             }</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum31">  31:</span>         }</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum32">  32:</span>     }</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum33">  33:</span>     </pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum34">  34:</span>     public virtual void Validate(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase)</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum35">  35:</span>     {</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum36">  36:</span>     }</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum37">  37:</span>&#160; </pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum38">  38:</span> }</pre>
<!--CRLF--></div>
  </div>
</div>

<p align="justify">In order to register this behavior with a <em>Service</em> hosted in AppFabric, you will want to be able to declare it in the <em>web.config </em>by defining the <em>BehaviorExtensionElement</em>. The following code snippet shows how you can do this for the previously supplied <em>Service</em> behavior:</p>

<div align="justify">
  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
    <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> public class PromotePropertiesBehaviorElement : BehaviorExtensionElement</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     private ConfigurationPropertyCollection properties<span style="color: #008000">;</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span> <span style="color: #008000"></span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span> <span style="color: #008000">    protected override object CreateBehavior()</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>     {</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>         PromotePropertiesBehavior behavior = new PromotePropertiesBehavior()<span style="color: #008000">;</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span> <span style="color: #008000">        return behavior;</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span>     }</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span>&#160; </pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11">  11:</span>     public override Type BehaviorType</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum12">  12:</span>     {</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum13">  13:</span>         get</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum14">  14:</span>         {</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum15">  15:</span>             <span style="color: #0000ff">return</span> typeof(PromotePropertiesBehavior)<span style="color: #008000">;</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum16">  16:</span> <span style="color: #008000">        }</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum17">  17:</span>     }</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum18">  18:</span>&#160; </pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum19">  19:</span>     protected override ConfigurationPropertyCollection Properties</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum20">  20:</span>     {</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum21">  21:</span>         get</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum22">  22:</span>         {</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum23">  23:</span>             <span style="color: #0000ff">if</span> (this.properties == null)</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum24">  24:</span>             {</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum25">  25:</span>                 ConfigurationPropertyCollection props = new ConfigurationPropertyCollection()<span style="color: #008000">;</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum26">  26:</span> <span style="color: #008000">                this.properties = props;</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum27">  27:</span>             }</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum28">  28:</span>             <span style="color: #0000ff">return</span> this.properties<span style="color: #008000">;</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum29">  29:</span> <span style="color: #008000">        }</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum30">  30:</span>     }</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum31">  31:</span> }</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum32">  32:</span>&#160; </pre>
<!--CRLF--></div>
  </div>
</div>

<h3>&#160;</h3>

<h3>Define Persistence Participant</h3>

<p align="justify">To ensure <em>Promoted Properties</em> are updated when the state of the <em>Workflow Service Instance</em> is updated in the Persistence Store, we need to define a <em>PersistenceParicipant</em> that can correctly map values supplied from a <em>Workflow Service</em> <em>Instance</em> to the schema defined in the Service behavior. The following class shows how we might do this for this blog’s scenario. Of course, this needs to be appropriately modified to be used in your scenario. </p>

<div align="justify">
  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
    <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> public class CustomPropertiesParticipant: PersistenceParticipant</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     XNamespace xNS = XNamespace.Get(<span style="color: #006080">&quot;https://samples.com/CustomProperties&quot;</span>)<span style="color: #008000">;</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span> <span style="color: #008000"></span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span> <span style="color: #008000">    public string ConvertFrom;</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>     public string ConvertTo<span style="color: #008000">;</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span> <span style="color: #008000">    public string StartOrComplete;</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>     public DateTime LastPropUpdateDateTime<span style="color: #008000">;</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span> <span style="color: #008000">    public double Duration;</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span>&#160; </pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11">  11:</span>     protected override void CollectValues(out IDictionary&lt;<span style="color: #008000">;System.Xml.Linq.XName, object&gt; readWriteValues, out IDictionary&lt;System.Xml.Linq.XName, object&gt; writeOnlyValues)</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum12">  12:</span>     {</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum13">  13:</span>         base.CollectValues(out readWriteValues, out writeOnlyValues)<span style="color: #008000">;</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum14">  14:</span> <span style="color: #008000"></span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum15">  15:</span> <span style="color: #008000">        readWriteValues = new Dictionary&lt;XName, object&gt;();</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum16">  16:</span>         readWriteValues.Add(xNS.GetName(<span style="color: #006080">&quot;ConvertFrom&quot;</span>), this.ConvertFrom)<span style="color: #008000">;</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum17">  17:</span> <span style="color: #008000">        readWriteValues.Add(xNS.GetName(&quot;ConvertTo&quot;), this.ConvertTo);</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum18">  18:</span>         readWriteValues.Add(xNS.GetName(<span style="color: #006080">&quot;StartOrComplete&quot;</span>), this.StartOrComplete)<span style="color: #008000">;</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum19">  19:</span> <span style="color: #008000">        readWriteValues.Add(xNS.GetName(&quot;LastPropUpdateDateTime&quot;), this.LastPropUpdateDateTime);</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum20">  20:</span>         readWriteValues.Add(xNS.GetName(<span style="color: #006080">&quot;Duration&quot;</span>), this.Duration)<span style="color: #008000">;</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum21">  21:</span> <span style="color: #008000"></span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum22">  22:</span> <span style="color: #008000">        writeOnlyValues = null;</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum23">  23:</span>     </pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum24">  24:</span>     }</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum25">  25:</span>&#160; </pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum26">  26:</span>     protected override void PublishValues(IDictionary&lt;<span style="color: #008000">;System.Xml.Linq.XName, object&gt; readWriteValues)</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum27">  27:</span>     {</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum28">  28:</span>         base.PublishValues(readWriteValues)<span style="color: #008000">;</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum29">  29:</span> <span style="color: #008000"></span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum30">  30:</span> <span style="color: #008000">        try</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum31">  31:</span>         {</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum32">  32:</span>&#160; </pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum33">  33:</span>             this.ConvertFrom = readWriteValues[xNS.GetName(<span style="color: #006080">&quot;ConvertFrom&quot;</span>)] as string<span style="color: #008000">;</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum34">  34:</span> <span style="color: #008000">            this.ConvertTo = readWriteValues[xNS.GetName(&quot;ConvertTo&quot;)] as string;</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum35">  35:</span>             this.StartOrComplete = readWriteValues[xNS.GetName(<span style="color: #006080">&quot;StartOrComplete&quot;</span>)] as string<span style="color: #008000">;</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum36">  36:</span> <span style="color: #008000"></span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum37">  37:</span> <span style="color: #008000">            if (readWriteValues[xNS.GetName(&quot;LastPropUpdateDateTime&quot;)] != null)</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum38">  38:</span>             {</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum39">  39:</span>                 this.LastPropUpdateDateTime = (DateTime)readWriteValues[xNS.GetName(<span style="color: #006080">&quot;LastPropUpdateDateTime&quot;</span>)]<span style="color: #008000">;</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum40">  40:</span> <span style="color: #008000">            }</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum41">  41:</span>&#160; </pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum42">  42:</span>             <span style="color: #0000ff">if</span> (readWriteValues[xNS.GetName(<span style="color: #006080">&quot;Duration&quot;</span>)] != null)</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum43">  43:</span>             {</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum44">  44:</span>                 this.Duration = (double)readWriteValues[xNS.GetName(<span style="color: #006080">&quot;Duration&quot;</span>)]<span style="color: #008000">;</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum45">  45:</span> <span style="color: #008000">            }</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum46">  46:</span>&#160; </pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum47">  47:</span>         }</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum48">  48:</span>         catch (Exception ex)</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum49">  49:</span>         {</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum50">  50:</span>&#160; </pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum51">  51:</span>         }</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum52">  52:</span>&#160; </pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum53">  53:</span>     }</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum54">  54:</span>&#160; </pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum55">  55:</span>     protected override IDictionary&lt;<span style="color: #008000">;System.Xml.Linq.XName, object&gt; MapValues(IDictionary&lt;System.Xml.Linq.XName, object&gt; readWriteValues, IDictionary&lt;System.Xml.Linq.XName, object&gt; writeOnlyValues)</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum56">  56:</span>     {</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum57">  57:</span>         <span style="color: #0000ff">return</span> base.MapValues(readWriteValues, writeOnlyValues)<span style="color: #008000">;</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum58">  58:</span> <span style="color: #008000">    }</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum59">  59:</span>&#160; </pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum60">  60:</span> }</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum61">  61:</span>&#160; </pre>
<!--CRLF--></div>
  </div>
</div>

<p align="justify">In the above code snippet, the <em>CollectValues</em> method is what maps the values supplied from the <em>Workflow Service Instance </em>to the schema when the <em>Workflow</em> is persisted. The <em>PublishValues</em> method loads the values read from Persistence and makes them available to your instance for reading and writing.</p>

<h3>&#160;</h3>

<h3>Web.config for the Scenario</h3>

<p align="justify">With the appropriate classes in place, you finally need to add the behavior to the <em>web.config</em> of the <em>Service</em>. Below is the complete <em>web.config</em> for the scenario.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">&lt;?</span><span style="color: #800000">xml</span> <span style="color: #ff0000">version</span><span style="color: #0000ff">=&quot;1.0&quot;</span> <span style="color: #ff0000">encoding</span><span style="color: #0000ff">=&quot;utf-8&quot;</span>?<span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">configuration</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>   <span style="color: #0000ff">&lt;</span><span style="color: #800000">system.web</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">compilation</span> <span style="color: #ff0000">debug</span><span style="color: #0000ff">=&quot;true&quot;</span> <span style="color: #ff0000">targetFramework</span><span style="color: #0000ff">=&quot;4.0&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>   <span style="color: #0000ff">&lt;/</span><span style="color: #800000">system.web</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>   <span style="color: #0000ff">&lt;</span><span style="color: #800000">system.serviceModel</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">behaviors</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>       <span style="color: #0000ff">&lt;</span><span style="color: #800000">serviceBehaviors</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span>         <span style="color: #0000ff">&lt;</span><span style="color: #800000">behavior</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span>           <span style="color: #0000ff">&lt;</span><span style="color: #800000">serviceMetadata</span> <span style="color: #ff0000">httpGetEnabled</span><span style="color: #0000ff">=&quot;true&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11">  11:</span>           <span style="color: #0000ff">&lt;</span><span style="color: #800000">serviceDebug</span> <span style="color: #ff0000">includeExceptionDetailInFaults</span><span style="color: #0000ff">=&quot;true&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum12">  12:</span>           <span style="color: #0000ff">&lt;</span><span style="color: #800000">promoteProperties</span> <span style="color: #0000ff">/&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum13">  13:</span>         <span style="color: #0000ff">&lt;/</span><span style="color: #800000">behavior</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum14">  14:</span>       <span style="color: #0000ff">&lt;/</span><span style="color: #800000">serviceBehaviors</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum15">  15:</span>     <span style="color: #0000ff">&lt;/</span><span style="color: #800000">behaviors</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum16">  16:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">extensions</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum17">  17:</span>       <span style="color: #0000ff">&lt;</span><span style="color: #800000">behaviorExtensions</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum18">  18:</span>         <span style="color: #0000ff">&lt;</span><span style="color: #800000">add</span> <span style="color: #ff0000">name</span><span style="color: #0000ff">=&quot;promoteProperties&quot;</span> <span style="color: #ff0000">type</span><span style="color: #0000ff">=&quot;ServiceExtensions.PromotePropertiesBehaviorElement, ServiceExtensions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum19">  19:</span>       <span style="color: #0000ff">&lt;/</span><span style="color: #800000">behaviorExtensions</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum20">  20:</span>     <span style="color: #0000ff">&lt;/</span><span style="color: #800000">extensions</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum21">  21:</span>   <span style="color: #0000ff">&lt;/</span><span style="color: #800000">system.serviceModel</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum22">  22:</span>   <span style="color: #0000ff">&lt;</span><span style="color: #800000">system.webServer</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum23">  23:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">modules</span> <span style="color: #ff0000">runAllManagedModulesForAllRequests</span><span style="color: #0000ff">=&quot;true&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum24">  24:</span>   <span style="color: #0000ff">&lt;/</span><span style="color: #800000">system.webServer</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum25">  25:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">configuration</span><span style="color: #0000ff">&gt;</span></pre>
<!--CRLF--></div>
</div>

<div align="justify">&#160;</div>

<h3>MWA Schema to include promotedProperties Element</h3>

<p align="justify" mce_keep="true">&#160;</p>

<p>First step is to register the behavior extension which adds the type of the<em> Custom Behavior Element</em> and provides a name for how the element will appear in the config file. Second, add the <em>Custom Behavior</em> to the <em>Service’s</em> collection of <em>Service</em> behaviors. Both are included in the config file above. </p>

<p>While we have defined a custom schema element in the config file, the Microsoft.Web.Administration (MWA) classes that AppFabric uses to read web.config will not recognize the <em>Custom Service Behavior</em> tag (e.g., in this case they will not recognize the <em>promoteProperties</em> element). This will result in an error on the IIS Manager dashboard. This is resolved by updating the MWA the schema to include the custom element. The updated schema is loaded in folder &lt;drive&gt;:\windows\system32\inetsrv\config\schema. </p>

<p>This schema <em>(ServiceExtensions_Schema.xml)</em> includes the &lt;<em>promotedProperties</em>&gt; element within the <em>serviceBehaviors</em> element in <em>system.serviceModel/behavior</em> node. The appropriate snippet of the schema is provided below. </p>

<div align="justify">
  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
    <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> &lt;<span style="color: #008000">;configSchema&gt;</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span>   &lt;<span style="color: #008000">;sectionSchema name=&quot;system.serviceModel/behaviors&quot;&gt;</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     &lt;<span style="color: #008000">;element name=&quot;serviceBehaviors&quot;&gt;</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>       &lt;<span style="color: #008000">;collection addElement=&quot;behavior&quot; removeElement=&quot;remove&quot; clearElement=&quot;clear&quot; allowDuplicates=&quot;true&quot;&gt;</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>         &lt;<span style="color: #008000">;element name=&quot;promoteProperties&quot;/&gt;</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>       &lt;<span style="color: #008000">;/collection&gt;</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>     &lt;<span style="color: #008000">;/element&gt;</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>   &lt;<span style="color: #008000">;/sectionSchema&gt;</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span> &lt;<span style="color: #008000">;/configSchema&gt;</span></pre>
<!--CRLF--></div>
  </div>
</div>

<h2>Using PromotedProperties in Workflow Services</h2>

<p align="justify">With the infrastructure in place, the <em>Workflow Service Instance</em> is ready to generate the <em>Promoted Properties</em>. Technically, the <em>Workflow Activities</em> are responsible for updating the values as a part of their execution. For convenience, below is a code snippet of a <em>Custom Workflow Activity</em> whose sole purpose is to update these <em>Promoted Property </em>values when it executes. </p>

<div align="justify">
  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
    <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> public sealed class CaptureAnalyticProperty : CodeActivity</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     public InArgument&lt;<span style="color: #008000">;string&gt; ConvertFrom { get; set; }</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     public InArgument&lt;<span style="color: #008000">;string&gt; ConvertTo { get; set; }</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>     public InArgument&lt;<span style="color: #008000">;string&gt; StartOrComplete { get; set; }</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>       </pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>     protected override void Execute(CodeActivityContext context)</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>     {</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span>         string valConvertFrom = context.GetValue(this.ConvertFrom)<span style="color: #008000">;</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span> <span style="color: #008000">        string valConvertTo = context.GetValue(this.ConvertTo);</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11">  11:</span>         string valStartOrComplete = context.GetValue(this.StartOrComplete)<span style="color: #008000">;</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum12">  12:</span> <span style="color: #008000"></span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum13">  13:</span> <span style="color: #008000">        try</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum14">  14:</span>         {</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum15">  15:</span>             context.GetExtension&lt;<span style="color: #008000">;ServiceExtensions.CustomPropertiesParticipant&gt;().ConvertFrom = valConvertFrom;</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum16">  16:</span>             context.GetExtension&lt;<span style="color: #008000">;ServiceExtensions.CustomPropertiesParticipant&gt;().ConvertTo = valConvertTo;</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum17">  17:</span>             context.GetExtension&lt;<span style="color: #008000">;ServiceExtensions.CustomPropertiesParticipant&gt;().StartOrComplete = valStartOrComplete;</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum18">  18:</span>&#160; </pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum19">  19:</span>             DateTime currentTime = DateTime.UtcNow<span style="color: #008000">;</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum20">  20:</span> <span style="color: #008000"></span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum21">  21:</span> <span style="color: #008000">            if (valStartOrComplete.ToLower().Equals(&quot;complete&quot;))</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum22">  22:</span>             {</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum23">  23:</span>                 context.GetExtension&lt;<span style="color: #008000">;ServiceExtensions.CustomPropertiesParticipant&gt;().Duration =</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum24">  24:</span>                     (currentTime - context.GetExtension&lt;<span style="color: #008000">;ServiceExtensions.CustomPropertiesParticipant&gt;().LastPropUpdateDateTime).TotalSeconds;</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum25">  25:</span>             }</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum26">  26:</span>&#160; </pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum27">  27:</span>             context.GetExtension&lt;<span style="color: #008000">;ServiceExtensions.CustomPropertiesParticipant&gt;().LastPropUpdateDateTime = currentTime;</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum28">  28:</span>         }</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum29">  29:</span>         catch (Exception ex)</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum30">  30:</span>         {</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum31">  31:</span>             CustomTrackingRecord rec = new System.Activities.Tracking.CustomTrackingRecord(<span style="color: #006080">&quot;CaptureAnalyticPropertyError&quot;</span>, System.Diagnostics.TraceLevel.Error)<span style="color: #008000">;</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum32">  32:</span> <span style="color: #008000">            rec.Data.Add(&quot;Suggested Fix:&quot;, &quot;Verify that the PromotePropertiesBehavior has been added in config.&quot;);</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum33">  33:</span>             rec.Data.Add(<span style="color: #006080">&quot;Error:&quot;</span>, ex.ToString())<span style="color: #008000">;</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum34">  34:</span> <span style="color: #008000">            context.Track(rec);</span></pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum35">  35:</span>         }</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum36">  36:</span>&#160; </pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum37">  37:</span>     }</pre>
<!--CRLF-->

      <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum38">  38:</span> }</pre>
<!--CRLF--></div>
  </div>
</div>

<p align="justify">To generate <em>Promoted Properties</em> we simply drag this <em>Custom Workflow Activity</em> into the Workflow design and provide its arguments the appropriate values. During the <em>Workflow</em> execution and persistence, the values are updated by this activity in the <em>InstancePromotedPropertiesTable</em> and its corresponding view, <i>InstancePromotedProperties</i>.</p>

<h2>Real world implementations</h2>

<p align="justify">In this section i reference a real world solution implemented by an ISV using this <em>Promoted Properties</em> feature. The ISV Solution at any give time have several instances of the same long running <em>Workflow</em>, processing a financial transaction for example waiting for payment authorization. The <em>Promoted Properties feature </em>prevented the ISV from having to store metadata along with the <em>WorkflowInstanceId</em> that would be needed to query against. This functionality also provided the&#160; additional extensibility option to use the eventing model to resume a particular <em>WorkflowInstance </em>based upon an event scenario and selecting the proper <em>WorkflowInstance </em>to resume based on querying the metadata. </p>

<p align="justify">Trending the metadata is also an interesting by product. The ISV archive the data rather than just deleting it. The ISV aligns the metadata with performance monitoring data, and looks at this historically to determine the user preference and how often poor performing <em>Workflows </em>are being invoked or particular parameter/metadata sets that are causing typically well performing workflows to have a dramatic change. </p>

<h2>Additional Resources</h2>

<p>Windows Server AppFabric: <a title="https://msdn.microsoft.com/en-us/windowsserver/ee695849.aspx" href="https://msdn.microsoft.com/en-us/windowsserver/ee695849.aspx" mce_href="https://msdn.microsoft.com/en-us/windowsserver/ee695849.aspx">https://msdn.microsoft.com/en-us/windowsserver/ee695849.aspx</a></p>

<p>MSDN Documentation on Promoted Properties - <a href="https://msdn.microsoft.com/en-us/library/ee364726(v=VS.100).aspx" mce_href="https://msdn.microsoft.com/en-us/library/ee364726(v=VS.100).aspx">https://msdn.microsoft.com/en-us/library/ee364726(v=VS.100).aspx</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Streamlining Custom Pipeline Component Development Using Base Class Library</title>
      <link>https://docs.microsoft.com/archive/blogs/asgisv/streamlining-custom-pipeline-component-development-using-base-class-library</link>
      <pubDate>Fri, 07 May 2010 17:43:00 GMT</pubDate>
      <dc:creator><![CDATA[ValeryM]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/asgisv/2010/05/07/streamlining-custom-pipeline-component-development-using-base-class-library/</guid>
      <description><![CDATA[It is widely known that custom pipeline components are highly popular extensibility points in the...]]></description>
      <content:encoded><![CDATA[<p align="justify">It is widely known that custom pipeline components are highly popular extensibility points in the BizTalk architecture. The topic has been extensively discussed for many years and many useful content is available on the Web. Through observations in recent customer engagements, we noticed that there is still a couple of recommendations which could be made to help BizTalk developers save time and streamline the development of custom pipeline components. The following blog post is based off a successful customer engagement during which the concepts highlighted below have been validated and proven in a real-world BizTalk solution. It&rsquo;s time for the community to benefit from our lessons learned, hence this post.</p>
<p align="justify">As things stand at the moment, a substantial amount of repetitive coding may be involved when building custom pipeline components. Every custom pipeline component requires repetitive implementation of a minimum of 3 standard interfaces (<em><a target="_blank" href="https://msdn.microsoft.com/en-us/library/microsoft.biztalk.component.interop.ibasecomponent(BTS.10).aspx"><strong>IBaseComponent</strong></a></em>, <em><a target="_blank" href="https://msdn.microsoft.com/en-us/library/aa962988(v=BTS.10).aspx"><strong>IPersistPropertyBag</strong></a></em>, <em><a target="_blank" href="https://msdn.microsoft.com/en-us/library/microsoft.biztalk.component.interop.icomponentui(BTS.10).aspx"><strong>IComponentUI</strong></a></em>) and one extra interface depending on the component type (<em><a target="_blank" href="https://msdn.microsoft.com/en-us/library/microsoft.biztalk.component.interop.icomponent(BTS.10).aspx"><strong>IComponent</strong></a></em>, <em><a target="_blank" href="https://msdn.microsoft.com/en-us/library/microsoft.biztalk.component.interop.iassemblercomponent(BTS.10).aspx"><strong>IAssemblerComponent</strong></a></em>, <em><a target="_blank" href="https://msdn.microsoft.com/en-us/library/microsoft.biztalk.component.interop.idisassemblercomponent(BTS.10).aspx"><strong>IDisassemblerComponent</strong></a></em>). </p>
<p align="justify">One of the challenges is that implementation logic of the 3 standard interfaces is often duplicated leading to extra code to be maintained. The amount of duplicate logic can be greatly minimized by introducing a set of base classes from which BizTalk developers can derive their implementations of custom pipeline components. It will help eliminate the majority of repetitive tasks typically involved in the development of pipeline components such as writing plumbing code for persisting and reading configuration properties, returning user-friendly property names, descriptions and design-time metadata elements.</p>
<p align="justify">Moreover, by just adding a bit of intellect into the base class library, it will be possible to enable the developers to apply declarative attributes in order to rapidly customize their pipeline components with localizable titles, descriptions, design-time icons and friendly property names without writing a single line of plumbing code.</p>
<p align="justify">In order to demonstrate the benefits of the reusable base class library, we have built a prototype which quickly turned itself into a first-class member of the solution framework in the customer project. The new base classes helped the developers ensure that all custom pipeline components share common capabilities such as instrumentation, exception handling, loading and saving component configuration, BAM tracking and more.</p>
<p align="justify">We have provided 3 abstract base classes (<em><strong>CustomComponentBase</strong></em>, <em><strong>AssemblerComponentBase</strong></em> and <em><strong>DisassemblerComponentBase</strong></em>) from which the developers derive their end implementations. The class diagram can be depicted as follows: <br /><img height="402" width="800" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/asgisv/WindowsLiveWriter/StreamliningCustomPipelineComponentDevel_9D31/aaaaa_3.png" original-url="https://blogs.msdn.com/blogfiles/asgisv/WindowsLiveWriter/StreamliningCustomPipelineComponentDevel_9D31/aaaaa_3.png" alt="aaaaa" border="0" title="aaaaa" style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" />&nbsp; <br />The key benefit of this design was that the amount of plumbing code required for building a custom pipeline component was greatly reduced. The BizTalk developers were able to take advantage of the declarative programming model and add support for fully localizable UI elements such as property names, descriptions and toolbox icons without writing a single line of code. They were also able to stay focused on the core logic whereas the responsibility for exception handling, instrumentation and toolbox interoperability was offloaded to the base class library. This reduced the overall implementation time and delivered better quality code.</p>
<p>&nbsp;</p>
<p align="justify">The example below illustrates the difference between traditional approach and the new concepts in the pipeline component development:</p>
<pre class="csharpcode"><span class="rem">//</span>
<span class="rem">// <strong>Pipeline component configuration property management using the traditional approach (equal to 46 lines of code).</strong></span>
<span class="rem">//</span>
<span class="kwrd">private</span> <span class="kwrd">string</span> customProperty1 = <span class="str">"default value"</span>;

[Description(<span class="str">"Static description for customProperty1 embedded into code"</span>)]
<span class="kwrd">public</span> <span class="kwrd">string</span> СustomProperty1
{
      get { <span class="kwrd">return</span> <span class="kwrd">this</span>.customProperty1; }
      set { <span class="kwrd">this</span>.customProperty1 = <span class="kwrd">value</span>; }
}

<span class="kwrd">private</span> <span class="kwrd">bool</span> customProperty2 = <span class="kwrd">false</span>;

[Description(<span class="str">"Static description for customProperty2 embedded into code"</span>)]
<span class="kwrd">public</span> <span class="kwrd">bool</span> СustomProperty2
{
    get { <span class="kwrd">return</span> <span class="kwrd">this</span>.customProperty2; }
    set { <span class="kwrd">this</span>.customProperty2 = <span class="kwrd">value</span>; }
}

<span class="kwrd">private</span> <span style="color: #0000ff;">int</span> customProperty3 = <span class="kwrd">true</span>;

[Description(<span class="str">"Static description for customProperty3 embedded into code"</span>)]
<span class="kwrd">public</span> <span style="color: #0000ff;">int</span> СustomProperty3
{
    get { <span class="kwrd">return</span> <span class="kwrd">this</span>.customProperty3; }
    set { <span class="kwrd">this</span>.customProperty3 = <span class="kwrd">value</span>; }
}

<span class="kwrd">public</span> <span class="kwrd">virtual</span> <span class="kwrd">void</span> Load(IPropertyBag pb, <span class="kwrd">int</span> errlog)
{
      <span class="kwrd">object</span> val = <span class="kwrd">null</span>;

      val = <span class="kwrd">this</span>.ReadPropertyBag(pb, <span class="str">"СustomProperty1"</span>);

      <span class="kwrd">if</span> (val != <span class="kwrd">null</span>)
      {
            <span class="kwrd">this</span>.СustomProperty1 = (String)(val);
      }

      val = <span class="kwrd">this</span>.ReadPropertyBag(pb, <span class="str">"СustomProperty2"</span>);

      <span class="kwrd">if</span> (val != <span class="kwrd">null</span>)
      {
          <span class="kwrd">this</span>.СustomProperty2 = (<span class="kwrd">bool</span>)(val);
      }

      val = <span class="kwrd">this</span>.ReadPropertyBag(pb, <span class="str">"СustomProperty3"</span>);

      <span class="kwrd">if</span> (val != <span class="kwrd">null</span>)
      {
          <span class="kwrd">this</span>.СustomProperty3 = (<span style="color: #0000ff;">int</span>)(val);
      }
}

<span class="kwrd">public</span> <span class="kwrd">virtual</span> <span class="kwrd">void</span> Save(IPropertyBag pb, <span class="kwrd">bool</span> fClearDirty, <span class="kwrd">bool</span> fSaveAllProperties)
{
      <span class="kwrd">this</span>.WritePropertyBag(pb, <span class="str">"СustomProperty1"</span>, <span class="kwrd">this</span>.СustomProperty1);
      <span class="kwrd">this</span>.WritePropertyBag(pb, <span class="str">"СustomProperty2"</span>, <span class="kwrd">this</span>.СustomProperty2);
      <span class="kwrd">this</span>.WritePropertyBag(pb, <span class="str">"СustomProperty3"</span>, <span class="kwrd">this</span>.СustomProperty3);
}</pre>
<p align="justify">By contrast, the new base class library delivered greater simplicity which enabled replacing the above code fragment with the following:</p>
<pre class="csharpcode"><span class="rem">//</span>
<span class="rem">// <strong>Pipeline component configuration property management using the new approach (equal to 12 lines of code).</strong></span>
<span class="rem">//<br /></span><span class="rem">// <strong>PropNameСustomProperty[n] is a resource key, the actual name will be loaded from a locale-specific resource file.<br /></strong><span class="rem">// <strong>PropDescСustomProperty[n] is a resource key, the actual description will be loaded from a locale-specific resource file.<br /></strong><span class="rem">//</span>
</span></span>[Browsable(<span class="kwrd">true</span>)]
[BtsPropertyName(<span class="str">"PropNameСustomProperty1"</span>)]<br />[BtsDescription(<span class="str">"PropDescСustomProperty1"</span>)] <br /><span class="kwrd">public</span> <span class="kwrd">string</span> СustomProperty1 { get; set; }

[Browsable(<span class="kwrd">true</span>)]
[BtsPropertyName(<span class="str">"PropNameСustomProperty2"</span>)]
[BtsDescription(<span class="str">"PropDescСustomProperty2"</span>)]
<span class="kwrd">public</span> <span class="kwrd">bool</span> СustomProperty2 { get; set; }
 
[Browsable(<span class="kwrd">true</span>)]
[BtsPropertyName(<span class="str">"PropNameСustomProperty3"</span>)]
[BtsDescription(<span class="str">"PropDescСustomProperty3"</span>)]
<span class="kwrd">public</span> <span class="kwrd">int </span>СustomProperty3 { get; set; }</pre>
<p>

</p>
<p align="justify">In summary, the base class library helped encapsulate most common tasks typically associated with custom pipeline component development such as configuration property management. In the above example, the amount of plumbing code was reduced from 46 lines to 12 lines (that&rsquo;s 75% reduction). The new codebase is easier to maintain and it helps avoid common pitfalls such as forgetting to persist a property value into the property bag.</p>
<p align="justify">The reduction in the volume of redundant plumbing code is of course not the only benefit. The real power of a base class library for custom pipeline components comes with the ability to centralize all other common functionality which needs to be shared across all derived implementations:</p>
<ul>
<li>
<div align="justify"><strong>Common configuration properties </strong>&ndash; any common configuration properties which are required for all child implementations of pipeline components can be defined in the base class. This is very handy when there is a need to enrich the entire suite of pipeline components with a common set of properties and avoid duplicating them in each individual component.</div>
</li>
<li>
<div align="justify"><strong>Tracing and instrumentation</strong> &ndash; all derived implementations of pipeline components can be transparently instrumented with tracing performed by the base classes. This will enable all derived components to output key telemetry events into the trace log, for example, to indicate when the <em>Execute</em> method has been invoked, when it has finished and now long it has taken to execute. </div>
</li>
<li>
<div align="justify"><strong>Exception handling and reporting</strong> &ndash; the base class is a good place to consolidate the exception management logic and provide a common mechanism for catching, handling and reporting on run-time exceptions.</div>
</li>
</ul>
<p align="justify">Now, let&rsquo;s put everything that was being said about base class library for pipeline components into a visual context. For sake of simplicity, we will title all further sections as &ldquo;<em>This is how&hellip;</em>&rdquo;.</p>
<p align="justify"><strong><em>This is how class inheritance helps derive the end implementations based on particular type of pipeline component:</em></strong></p>
<p align="justify"><img height="525" width="700" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/asgisv/WindowsLiveWriter/StreamliningCustomPipelineComponentDevel_9D31/SamplePipelineComponentsClassDiagram_3.png" original-url="https://blogs.msdn.com/blogfiles/asgisv/WindowsLiveWriter/StreamliningCustomPipelineComponentDevel_9D31/SamplePipelineComponentsClassDiagram_3.png" alt="SamplePipelineComponentsClassDiagram" border="0" title="SamplePipelineComponentsClassDiagram" style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" />&nbsp; <br /><strong><em>This is how class inheritance helps derive the end implementations based on particular type of pipeline component: <br /></em></strong><img height="391" width="800" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/asgisv/WindowsLiveWriter/StreamliningCustomPipelineComponentDevel_9D31/p1_3.png" original-url="https://blogs.msdn.com/blogfiles/asgisv/WindowsLiveWriter/StreamliningCustomPipelineComponentDevel_9D31/p1_3.png" alt="p1" border="0" title="p1" style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" />&nbsp; <br /><em><strong>This is how a base class for disassembling pipeline components implements the IDisassemblerComponent interface: <br /><img height="246" width="650" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/asgisv/WindowsLiveWriter/StreamliningCustomPipelineComponentDevel_9D31/p2_9.png" original-url="https://blogs.msdn.com/blogfiles/asgisv/WindowsLiveWriter/StreamliningCustomPipelineComponentDevel_9D31/p2_9.png" alt="p2" border="0" title="p2" style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" />&nbsp;&nbsp; <br /></strong></em><em><strong>This is how the e<em><strong>xplicit implementation of the Disassemble method allows wrapping its user-defined counterpart into a rich instrumented context: <br /><img height="413" width="800" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/asgisv/WindowsLiveWriter/StreamliningCustomPipelineComponentDevel_9D31/p3_6.png" original-url="https://blogs.msdn.com/blogfiles/asgisv/WindowsLiveWriter/StreamliningCustomPipelineComponentDevel_9D31/p3_6.png" alt="p3" border="0" title="p3" style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" />&nbsp;</strong></em></strong></em></p>
<p align="justify">It is worth sharing some key notes and observations made during the development phase:</p>
<ul>
<li>
<div align="justify">When compiling a BizTalk pipeline containing a custom pipeline component implemented using the base class library, you will get the following warning message: <br /><br /><em><strong><span style="color: #ff0000;">Warning BTP0006: Component 'FullComponentTypeName' does not implement IComponentUI interface. </span><br /><br /></strong></em>This warning is the result of a missing interface implementation directly by the pipeline component. Since the <em><strong>IComponentUI</strong></em> interface is implemented by the <strong><em>PipelineComponentBase</em></strong> class, the compiler is not currently able to intelligently treat such a case. The warning message can be ignored (we found no way of suppressing this warning in the current release of BizTalk project system). We will see if this can be improved when we ship an update or service pack for the current release.</div>
</li>
<li>
<div align="justify">The derived implementation of a custom pipeline component will still have to be decorated with a <strong><em><a target="_blank" href="https://msdn.microsoft.com/en-us/library/aa963264(v=BTS.10).aspx">ComponentCategory</a></em></strong> attribute, otherwise the component will not show up on the Choose Items dialog in Visual Studio IDE. This is due to the fact that we are not currently reflecting the custom .NET attributes across the entire inheritance chain. Again, this appears to be an unfair limitation on which the Product Group was advised and asked to consider improving this behavior.</div>
</li>
</ul>
<p>

</p>
<p align="justify"><strong>Show me the <span style="text-decoration: line-through;">money</span> code! </strong>You can find the source code in the attachment below. Please share your feedback to help improve the base class library.</p>
<p align="justify"><strong><a href="https://code.msdn.microsoft.com/Project/Download/FileDownload.aspx?ProjectName=appfabriccat&amp;DownloadId=13984">Streamlining Custom Pipeline Component Development Using Base Class Library.zip</a></strong></p>
<p>For more information on the related topic, please visit the following resources:</p>
<ul>
<li>&ldquo;<a target="_blank" href="https://msdn.microsoft.com/en-us/library/aa548050(BTS.10).aspx">Developing Custom Pipeline Components</a>&rdquo; article in the MSDN Documentation </li>
<li>&ldquo;<a target="_blank" href="https://blogical.se/blogs/johan/archive/2008/01/02/custom-pipeline-components-development-best-practices.aspx">Custom Pipeline Components Development Best Practices</a>&rdquo; post on Johan Hedberg&rsquo;s blog </li>
<li>&ldquo;<a target="_blank" href="https://msdn.microsoft.com/en-us/library/ms173157(VS.90).aspx">Explicit Interface Implementation</a>&rdquo; article in the C# Programming Guide</li>
</ul>]]></content:encoded>
    </item>
    <item>
      <title>Windows Server AppFabric: Extensibility to support remote troubleshooting</title>
      <link>https://docs.microsoft.com/archive/blogs/asgisv/windows-server-appfabric-extensibility-to-support-remote-troubleshooting</link>
      <pubDate>Thu, 06 May 2010 11:24:46 GMT</pubDate>
      <dc:creator><![CDATA[ValeryM]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/asgisv/2010/05/06/windows-server-appfabric-extensibility-to-support-remote-troubleshooting/</guid>
      <description><![CDATA[A common problem ISV support teams (and multi location enterprises, e.g., Microsoft) have to grapple...]]></description>
      <content:encoded><![CDATA[<p align="justify">A common problem ISV support teams (and multi location enterprises, e.g., Microsoft) have to grapple with is providing debugging assistance to IT Admin and Junior Developers at remote locations. Compounding the problem is restricted access to the machine due to logistical or security considerations. Packaging the meta data, instance data and log files relating to the erroneous instance is not a unique idea; however, this blog is an original attempt to provide a design for the Windows Server AppFabric. </p>  <p align="justify">While the blog provides designs to build and consume the package, it does not elaborate on the Workflow Visualizer which is widely covered in technology blogs and MSDN (<a href="https://msdn.microsoft.com/en-us/library/cc835242.aspx">https://msdn.microsoft.com/en-us/library/cc835242.aspx</a>). </p>  <h1>Scenario</h1>  <p align="justify"><font size="2">Consider a situation where an ISV has created a re-hosted Workflow Designer and Visualizer that their customers use to create, deploy and also debug their solutions.&#160; When the customer encounters a problem that they are unable to debug/address; they turn to the ISV support team to help with troubleshooting and finding a solution to the issue. An obvious challenge is that the ISV support team is not on site or does not have direct access to the AppFabric machines to debug the problem. So it’s imperative that the Support Team should be able to reconstruct the erroneous scenario from the customer and log data. </font></p>  <p align="justify"><font size="2">The grahic below (executed within the Visualizer Application) demonstrates an exception being thrown. The customer offline tests and deploys a Workflow; however this Workflow throws an exception in a specific uses case and aborts. The customer is unable to debug and provide a fix. This finally escalates into a call to the ISV Support team. </font></p>  <p><font size="2"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image002" border="0" alt="clip_image002" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/asgisv/WindowsLiveWriter/WindowsServerAppFabricExtensibilitytosup_A07B/clip_image002_e711a7c3-6fc6-44fb-a8a2-88f9e8444d40.jpg" original-url="https://blogs.msdn.com/blogfiles/asgisv/WindowsLiveWriter/WindowsServerAppFabricExtensibilitytosup_A07B/clip_image002_e711a7c3-6fc6-44fb-a8a2-88f9e8444d40.jpg" width="606" height="202" /></font></p>  <p align="justify"><font size="2">Per instructions from the ISV Support team, the customer reopens the erroneous project; loads the specific instance of its execution and creates a snapshot using the appropriate interfaces in the Visualizer. This Snapshot is a package of the project, its supporting files (XAMLX and assemblies) and the event data AppFabric collected from the instance in question via the instrumentation elaborated in previous sections. </font></p>  <p align="justify"><font size="2">This ‘package’ will be loaded by the ISV Support team in the Visualizer to ‘reproduce’ the error on the ‘specific’ Workflow along with the related instance data.</font></p>  <h1>Solution </h1>  <p align="justify"><font size="2">Leveraging the Windows Server AppFabric ability to track Workflow and WCF event data; the ISV's Workflow Designer created a great support feature that allows the customer to quickly and reliably build a ‘package’ and share their meta and instance data with the ‘offline’ ISV Support team.</font></p>  <h2>Instrumentation</h2>  <p align="justify"><font size="2">In order to keep this ‘execution’ data separate from other event data that AppFabric monitors on the customer's machine, a separate monitoring database is installed that is only for the use of the ISV's Workflow Designer. Setting up this database is quite simple as elaborated in the PowerShell Scripts below. </font></p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> import-module ApplicationServer</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> Initialize-ASMonitoringSqlDatabase -Database WorkflowDesignerMonitoringDB -Server .\SqlExpress</pre>
<!--CRLF--></div>
</div>

<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/asgisv/WindowsLiveWriter/WindowsServerAppFabricExtensibilitytosup_A07B/image_402fee3b-6f21-4be7-91e1-cdbd18ba244f.png" original-url="https://blogs.msdn.com/blogfiles/asgisv/WindowsLiveWriter/WindowsServerAppFabricExtensibilitytosup_A07B/image_402fee3b-6f21-4be7-91e1-cdbd18ba244f.png" width="606" height="119" />&#160; </p>

<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/asgisv/WindowsLiveWriter/WindowsServerAppFabricExtensibilitytosup_A07B/image_3e4c5c9a-81d4-43bf-b5e3-43a98be3dcf3.png" original-url="https://blogs.msdn.com/blogfiles/asgisv/WindowsLiveWriter/WindowsServerAppFabricExtensibilitytosup_A07B/image_3e4c5c9a-81d4-43bf-b5e3-43a98be3dcf3.png" width="606" height="151" /></p>

<p>&#160;</p>

<h2>Design and Implementation </h2>

<p align="justify"><font size="2">Let's take a closer look at the design to build this solution.</font></p>

<h3>Querying for the instance</h3>

<p align="justify"><font size="2">The customer can pull up a list of the Workflow instances and select the erroneous one with a menu we populate using the AppFabric tables <i>ASWfInstances</i> and <i>ASEventSources</i>.</font></p>

<h5><em>ASWfInstancesTable </em></h5>

<table border="1" cellspacing="0" cellpadding="0"><tbody>
    <tr>
      <td valign="top" width="201">
        <p><b><font size="2">Field</font></b></p>
      </td>

      <td valign="top" width="215">
        <p><b><font size="2">Description</font></b></p>
      </td>

      <td valign="top" width="205">
        <p><b><font size="2">Example data</font></b></p>
      </td>
    </tr>

    <tr>
      <td valign="top" width="201">
        <p><em><font size="2">Id</font></em></p>
      </td>

      <td valign="top" width="215"><font size="2">-</font></td>

      <td valign="top" width="205"><font size="2">-</font></td>
    </tr>

    <tr>
      <td valign="top" width="201">
        <p><em><font size="2">WorkflowInstanceId</font></em></p>
      </td>

      <td valign="top" width="215">
        <p><font size="2">GUID uniquely identifyies each instance</font></p>
      </td>

      <td valign="top" width="205">
        <p><font size="2">0f43ee0a-d661-4d14-8657-67003</font></p>
      </td>
    </tr>

    <tr>
      <td valign="top" width="201">
        <p><em><font size="2">LatestRecordNumber</font></em></p>
      </td>

      <td valign="top" width="215"><font size="2">-</font></td>

      <td valign="top" width="205"><font size="2">-</font></td>
    </tr>

    <tr>
      <td valign="top" width="201">
        <p><em><font size="2">LastEventSourceId</font></em></p>
      </td>

      <td valign="top" width="215">
        <p><font size="2">Last file to emit an event in this instance</font></p>
      </td>

      <td valign="top" width="205"><font size="2">-</font></td>
    </tr>

    <tr>
      <td valign="top" width="201">
        <p><em><font size="2">LastEventStatus</font></em></p>
      </td>

      <td valign="top" width="215">
        <p><font size="2">Last state of this instance</font></p>
      </td>

      <td valign="top" width="205">
        <p><font size="2">Aborted/Completed/Idle/Suspended</font></p>
      </td>
    </tr>

    <tr>
      <td valign="top" width="201">
        <p><em><font size="2">StartTime</font></em></p>
      </td>

      <td valign="top" width="215"><font size="2">-</font></td>

      <td valign="top" width="205"><font size="2">-</font></td>
    </tr>

    <tr>
      <td valign="top" width="201">
        <p><em><font size="2">LastModifiedTime</font></em></p>
      </td>

      <td valign="top" width="215">
        <p><font size="2">The last time this instance did anything</font></p>
      </td>

      <td valign="top" width="205"><font size="2">-</font></td>
    </tr>

    <tr>
      <td valign="top" width="201">
        <p><em><font size="2">CurrentDuration</font></em></p>
      </td>

      <td valign="top" width="215">
        <p><font size="2">Total execution time (in milliseconds)</font></p>
      </td>

      <td valign="top" width="205">
        <p><font size="2">3</font></p>
      </td>
    </tr>

    <tr>
      <td valign="top" width="201">
        <p><em><font size="2">ExceptionCount</font></em></p>
      </td>

      <td valign="top" width="215">
        <p><font size="2"># of exceptions that occurred</font></p>
      </td>

      <td valign="top" width="205">
        <p><font size="2">1</font></p>
      </td>
    </tr>

    <tr>
      <td valign="top" width="201">
        <p><em><font size="2">LastAbortedTime</font></em></p>
      </td>

      <td valign="top" width="215">
        <p><font size="2">Time the instance failed</font></p>
      </td>

      <td valign="top" width="205"><font size="2">-</font></td>
    </tr>
  </tbody></table>

<p><i><font size="2"></font></i></p>

<p><i><font size="2"></font></i></p>

<p><i><font size="2"></font></i></p>

<p align="justify"><font size="2">Table<i> ASWfInstances</i> above holds information about each instance that has been executed. The fields <em>ExceptionCount</em>, <em>LastAbortedTime</em> and <em>LastEventStatus</em> should all help the user in finding the erroneous instance. However, this table does not contain information about the application or .XAMLX files involved. For this we use <em>LastEventSourceId</em> to combine this data with the information contained in table <i>ASEventSources</i>. With the extra detail that <i>ASEventSources</i> provides it should be possible for the user to identify the instance being sought.</font></p>

<h5><em>ASEventSourcesTable</em></h5>

<table border="1" cellspacing="0" cellpadding="0" width="638"><tbody>
    <tr>
      <td valign="top" width="198">
        <p><b><font size="2">Field</font></b></p>
      </td>

      <td valign="top" width="222">
        <p><b><font size="2">Description</font></b></p>
      </td>

      <td valign="top" width="216">
        <p><b><font size="2">Example Data</font></b></p>
      </td>
    </tr>

    <tr>
      <td valign="top" width="198">
        <p><font size="2">Id</font></p>
      </td>

      <td valign="top" width="222"><font size="2">-</font></td>

      <td valign="top" width="216"><font size="2">-</font></td>
    </tr>

    <tr>
      <td valign="top" width="198">
        <p><font size="2">Name</font></p>
      </td>

      <td valign="top" width="222">
        <p><font size="2">Name of the file</font></p>
      </td>

      <td valign="top" width="216">
        <p><font size="2">Service</font></p>
      </td>
    </tr>

    <tr>
      <td valign="top" width="198">
        <p><font size="2">Computer</font></p>
      </td>

      <td valign="top" width="222"><font size="2">-</font></td>

      <td valign="top" width="216">
        <p><font size="2">Example-PC</font></p>
      </td>
    </tr>

    <tr>
      <td valign="top" width="198">
        <p><font size="2">Site</font></p>
      </td>

      <td valign="top" width="222">
        <p><font size="2">IIS Server website</font></p>
      </td>

      <td valign="top" width="216">
        <p><font size="2">Default Web Site</font></p>
      </td>
    </tr>

    <tr>
      <td valign="top" width="198">
        <p><font size="2">VirtualPath</font></p>
      </td>

      <td valign="top" width="222">
        <p><font size="2">IIS application and file</font></p>
      </td>

      <td valign="top" width="216">
        <p><font size="2">/ExampleApp/Service.xamlx</font></p>
      </td>
    </tr>

    <tr>
      <td valign="top" width="198">
        <p><font size="2">ApplicationVirtualPath</font></p>
      </td>

      <td valign="top" width="222">
        <p><font size="2">Just the IIS application</font></p>
      </td>

      <td valign="top" width="216">
        <p><font size="2">/ExampleApp</font></p>
      </td>
    </tr>

    <tr>
      <td valign="top" width="198">
        <p><font size="2">ServiceVirtualPath</font></p>
      </td>

      <td valign="top" width="222">
        <p><font size="2">Just the file</font></p>
      </td>

      <td valign="top" width="216">
        <p><font size="2">/Service.xamlx</font></p>
      </td>
    </tr>
  </tbody></table>

<p><font size="2">Here is a query used for combining the info from these two tables:</font></p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">SELECT</span>        wfSvcs.VirtualPath, wfInst.LastModifiedTime, wfInst.LastEventStatus, wfInst.WorkflowInstanceId, wfSvcs.Site, wfSvcs.Name, wfInst.StartTime, wfInst.CurrentDuration, </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span>                          wfInst.ExceptionCount, wfInst.LastAbortedTime</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span> FROM            ASWfInstances AS wfInst INNER JOIN</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>                          ASEventSources AS wfSvcs ON wfSvcs.Id = wfInst.LastEventSourceId</pre>
<!--CRLF--></div>
</div>

<p align="justify"><font size="2">Typical results demonstrating this query:</font></p>

<p align="justify"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/asgisv/WindowsLiveWriter/WindowsServerAppFabricExtensibilitytosup_A07B/image_ffec7708-eb2f-45a3-9777-3430db2f438c.png" original-url="https://blogs.msdn.com/blogfiles/asgisv/WindowsLiveWriter/WindowsServerAppFabricExtensibilitytosup_A07B/image_ffec7708-eb2f-45a3-9777-3430db2f438c.png" width="606" height="182" /> </p>

<h3>Creating the package</h3>

<p align="justify"><font size="2">With the instance now selected, the ISV Application gathers the associated event data to be stored in its own monitoring database in preparation for transport. Using this instance’s <em>WorkflowInstanceId</em> the event data is gathered in the following manner:</font></p>

<p align="justify"><font size="2">The <em>ASWfEventsTable</em> is queried using the <em>WorkflowInstanceId</em> as shown below. This table gives us all of the events that occurred during the execution of this instance.</font></p>

<h5><em>ASWfEventsTable</em> </h5>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">SELECT</span>        Id, EventTypeId, EventSourceId, ProcessId, TraceLevelId, WorkflowInstanceId, RecordNumber, TrackingProfileId, AnnotationSetId, TimeCreated, Data1Str, Data2Str, </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span>                          Data3Str, Data4Str, Data5Str, Data6Str, Data7Str, Data8Str, Data1MaxStr, Data1Int</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span> FROM            ASWfEventsTable</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span> WHERE        (WorkflowInstanceId = @InstanceGuid)</pre>
<!--CRLF--></div>
</div>

<p><i></i></p>

<p><font size="2">Significant fields listed below. </font></p>

<p>
  <table border="1" cellspacing="0" cellpadding="0" width="594"><tbody>
      <tr>
        <td valign="top" width="125">
          <p><b><font size="2">Field</font></b></p>
        </td>

        <td valign="top" width="245">
          <p><b><font size="2">Description</font></b></p>
        </td>

        <td valign="top" width="222">
          <p><b><font size="2">Example Data</font></b></p>
        </td>
      </tr>

      <tr>
        <td valign="top" width="125">
          <p><font size="2"><em>EventTypeId</em></font></p>
        </td>

        <td valign="top" width="245">
          <p><font size="2">Integer representing type of event (workflow events, wcf events, etc.)</font></p>
        </td>

        <td valign="top" width="222">
          <p><font size="2">103</font></p>
        </td>
      </tr>

      <tr>
        <td valign="top" width="125">
          <p><font size="2"><em>EventSourceId</em></font></p>
        </td>

        <td valign="top" width="245">
          <p><font size="2">Maps to service this event came from</font></p>
        </td>

        <td valign="top" width="222">
          <p><font size="2">63</font></p>
        </td>
      </tr>

      <tr>
        <td valign="top" width="125">
          <p><font size="2"><em>TraceLevelId</em></font></p>
        </td>

        <td valign="top" width="245">
          <p><font size="2">Indicates the level of this trace event (e.g., verbose, info, warn, error).</font></p>
        </td>

        <td valign="top" width="222">
          <p><font size="2">4</font></p>
        </td>
      </tr>

      <tr>
        <td valign="top" width="125">
          <p><font size="2"><em>WorkflowInstanceId</em></font></p>
        </td>

        <td valign="top" width="245">
          <p><font size="2">All events in this instance have this same id.</font></p>
        </td>

        <td valign="top" width="222">
          <p><font size="2">0f43ee0a-d661-4d14-8657-67003</font></p>
        </td>
      </tr>

      <tr>
        <td valign="top" width="125">
          <p><font size="2"><em>Data1Str</em></font></p>
        </td>

        <td valign="top" width="245">
          <p><font size="2">Context specific event descriptions</font></p>
        </td>

        <td valign="top" width="222">
          <p><font size="2">Faulted</font></p>
        </td>
      </tr>

      <tr>
        <td valign="top" width="125">
          <p><font size="2"><em>Data2Str</em></font></p>
        </td>

        <td valign="top" width="245">
          <p><font size="2">Context specific event descriptions</font></p>
        </td>

        <td valign="top" width="222">
          <p><font size="2">Assign</font></p>
        </td>
      </tr>

      <tr>
        <td valign="top" width="125">
          <p><font size="2"><em>Data5Str</em></font></p>
        </td>

        <td valign="top" width="245">
          <p><font size="2">Context specific event descriptions</font></p>
        </td>

        <td valign="top" width="222">
          <p><font size="2">System.Activities.Statements.Assign</font></p>
        </td>
      </tr>
    </tbody></table>
</p>

<p align="justify"><font size="2"></font></p>

<p align="justify"><font size="2">From the result of this query we use the EventSourceId to get information we need from the ASEventSourcesTable as shown in the query that follows. As was stated earlier, this gives us descriptive information to use such as the website, application and source service. The ASEventSourcesTable’s data is described in more detail in the previous section, ‘Querying for the Instance’.</font></p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> int eventSourceId = asWfEventsTable.First().EventSourceId<span style="color: #008000">;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> <span style="color: #008000"></span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span> <span style="color: #008000">SELECT [Id]</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>       ,[Name]</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>       ,[Computer]</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>       ,[Site]</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>       ,[VirtualPath]</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>       ,[ApplicationVirtualPath]</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span>       ,[ServiceVirtualPath]</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span>   FROM [AppFabricMonitoring].[dbo].[ASEventSourcesTable]</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11">  11:</span>   WHERE [Id] = @eventSourceId</pre>
<!--CRLF--></div>
</div>

<p align="justify"><font size="2"></font></p>

<h5><em>ASWfEventPropertiesTable</em> </h5>

<p align="justify"><font size="2">This next table queried for information is the <em>ASWfEventPropertiesTable</em>. This table provides detailed information on the status of each event</font></p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> ASWfEventPropertiesTable</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> <span style="color: #0000ff">SELECT</span>                [EventId]</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>            ,[WfDataSourceId]</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>            ,[Name]</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>            ,[Type]</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>            ,[Value]</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>            ,[ValueBlob]</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>            ,[TimeCreated]</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span> FROM ASWfEventPropertiesTable</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span> WHERE [EventId] <span style="color: #0000ff">in</span> (<span style="color: #0000ff">SELECT</span> EventId FROM ASWfEventsTable WHERE [WorkflowInstanceId] = @InstanceGuid)</pre>
<!--CRLF--></div>
</div>

<p><font size="2">Significant fields listed below. </font></p>

<p>
  <table border="1" cellspacing="0" cellpadding="0" width="579"><tbody>
      <tr>
        <td valign="top" width="114">
          <p><b><font size="2">Field</font></b></p>
        </td>

        <td valign="top" width="266">
          <p><b><font size="2">Description</font></b></p>
        </td>

        <td valign="top" width="197">
          <p><b><font size="2">Example Data</font></b></p>
        </td>
      </tr>

      <tr>
        <td valign="top" width="114">
          <p><em><font size="2">EventId</font></em></p>
        </td>

        <td valign="top" width="266">
          <p><font size="2">The numeric id of the event type.</font></p>
        </td>

        <td valign="top" width="197">
          <p><font size="2">103</font></p>
        </td>
      </tr>

      <tr>
        <td valign="top" width="114">
          <p><em><font size="2">WfDataSourceId</font></em></p>
        </td>

        <td valign="top" width="266">
          <p><font size="2">The source of the event property which can be argument, variable or custom data.</font></p>
        </td>

        <td valign="top" width="197">
          <p><font size="2">0</font></p>
        </td>
      </tr>

      <tr>
        <td valign="top" width="114">
          <p><em><font size="2">Name</font></em></p>
        </td>

        <td valign="top" width="266">
          <p><font size="2">The name of the event property.</font></p>
        </td>

        <td valign="top" width="197">
          <p><font size="2">E2EActivityId</font></p>
        </td>
      </tr>

      <tr>
        <td valign="top" width="114">
          <p><em><font size="2">Type</font></em></p>
        </td>

        <td valign="top" width="266">
          <p><font size="2">The type of the property.</font></p>
        </td>

        <td valign="top" width="197">
          <p><font size="2">System.Guid</font></p>
        </td>
      </tr>

      <tr>
        <td valign="top" width="114">
          <p><em><font size="2">Value</font></em></p>
        </td>

        <td valign="top" width="266">
          <p><font size="2">The value of the property.</font></p>
        </td>

        <td valign="top" width="197">
          <p><font size="2">b82dbde2-d3b0-4ef5-be00-2713820a4128</font></p>
        </td>
      </tr>

      <tr>
        <td valign="top" width="114">
          <p><em><font size="2">ValueBlob</font></em></p>
        </td>

        <td valign="top" width="266">
          <p><font size="2">The value property when the type is a complex type.</font></p>
        </td>

        <td valign="top" width="197">
          <p><font size="2">NULL</font></p>
        </td>
      </tr>

      <tr>
        <td valign="top" width="114">
          <p><em><font size="2">TimeCreated</font></em></p>
        </td>

        <td valign="top" width="266">
          <p><font size="2">Timestamp when the property was emitted. </font></p>
        </td>

        <td valign="top" width="197"><font size="2">-</font></td>
      </tr>
    </tbody></table>
</p>

<p align="justify"><font size="2">Finally, the <em>ASWfPropertyNamesTable</em> and <em>ASWfTrackingProfilesTable</em> tables are queried. <em>ASWfTrackingProfilesTable</em> is used to capture the tracking profile in use.</font></p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> ASWfPropertyNamesTable</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> <span style="color: #0000ff">SELECT</span> [EventSourceId]</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>       ,[Name]</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>       ,[Type]</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span> FROM [ASWfPropertyNamesTable]</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span> WHERE [EventSourceId] = @eventSourceId</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>&#160; </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span> ASWfTrackingProfilesTable</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span> <span style="color: #0000ff">SELECT</span>        Id, Name</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span> FROM            ASWfTrackingProfilesTable</pre>
<!--CRLF--></div>
</div>

<p align="justify"><font size="2">Once the event monitoring information is queried and stored in the ISV’s monitoring database, this data and the project’s files can be written to the package file that is to be sent to ISV Support. This data is visualized on the user’s workflow for visualization of the problem.</font></p>

<p align="justify"><font size="2">Selected instance is visualized on the workflow</font></p>

<p align="justify"><font size="2"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image002" border="0" alt="clip_image002" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/asgisv/WindowsLiveWriter/WindowsServerAppFabricExtensibilitytosup_A07B/clip_image002_4a18ba0e-3f11-4e74-9676-c35ffb19dbed.gif" original-url="https://blogs.msdn.com/blogfiles/asgisv/WindowsLiveWriter/WindowsServerAppFabricExtensibilitytosup_A07B/clip_image002_4a18ba0e-3f11-4e74-9676-c35ffb19dbed.gif" width="606" height="169" /></font></p>

<p align="justify"><font size="2">With the desired instance visualized, the user chooses to create the package. In this application the package is referred to as a Snapshot. This file allows anyone to see exactly what this workflow was doing at a specific point in time, hence the term snapshot.</font></p>

<p align="justify"><font size="2"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image004" border="0" alt="clip_image004" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/asgisv/WindowsLiveWriter/WindowsServerAppFabricExtensibilitytosup_A07B/clip_image004_4f0c2711-c6c9-46f6-bcf0-313d8fd41657.gif" original-url="https://blogs.msdn.com/blogfiles/asgisv/WindowsLiveWriter/WindowsServerAppFabricExtensibilitytosup_A07B/clip_image004_4f0c2711-c6c9-46f6-bcf0-313d8fd41657.gif" width="606" height="79" /></font></p>

<p align="justify"><font size="2">The user chooses where to save this Snapshot file, it is created and can then be sent to the ISV Support Team</font></p>

<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image006" border="0" alt="clip_image006" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/asgisv/WindowsLiveWriter/WindowsServerAppFabricExtensibilitytosup_A07B/clip_image006_96440011-6446-43b3-9963-0f642c8dfca0.gif" original-url="https://blogs.msdn.com/blogfiles/asgisv/WindowsLiveWriter/WindowsServerAppFabricExtensibilitytosup_A07B/clip_image006_96440011-6446-43b3-9963-0f642c8dfca0.gif" width="606" height="165" /></p>

<h3>Loading the package</h3>

<p align="justify"><font size="2">The ISV Support team will load the package to begin the troubleshooting process. Loading the package requires opening the project and injecting the customer event data into the Monitoring Database used by the ISV Workflow Designer and Visualizer Application. This monitoring database is a separate copy of the monitoring database used specifically for storing the records of a single instance.</font></p>

<p align="justify"><font size="2">AppFabric serializes all of the data it stores; meaning that the customer’s event data in the package (which is serialized) needs to be un-serialized before it can be written to the database.</font></p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> BinaryFormatter bin = new BinaryFormatter()<span style="color: #008000">;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> <span style="color: #008000">FileStream fs = new FileStream(selectedSnapshot, FileMode.Open);</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span> DataSet ds = bin.Deserialize(fs) as DataSet<span style="color: #008000">;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span> fs.Close();</pre>
<!--CRLF--></div>
</div>

<p>&#160;<font size="2">With the data unpacked into a dataset, it is ready to be placed into the ISV Application’s monitoring database.</font></p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> AppFabricMonitoringDataSet.ASWfEventsTableDataTable asWfEventsTable =</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> ds.Tables[<span style="color: #006080">&quot;ASWfEventsTable&quot;</span>] as AppFabricMonitoringDataSet.ASWfEventsTableDataTable<span style="color: #008000">;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span> <span style="color: #008000">AppFabricMonitoringDataSet.ASEventSourcesTableDataTable asEventSourcesTable =</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span> ds.Tables[<span style="color: #006080">&quot;ASEventSourcesTable&quot;</span>]as AppFabricMonitoringDataSet.ASEventSourcesTableDataTable<span style="color: #008000">;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span> <span style="color: #008000">AppFabricMonitoringDataSet.ASWfEventPropertiesTableDataTable asWfEventPropertiesTable =</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span> ds.Tables[<span style="color: #006080">&quot;ASWfEventPropertiesTable&quot;</span>] as AppFabricMonitoringDataSet.ASWfEventPropertiesTableDataTable<span style="color: #008000">;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span> <span style="color: #008000">AppFabricMonitoringDataSet.ASWfPropertyNamesTableDataTable asWfPropertyNamesTable =</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span> ds.Tables[<span style="color: #006080">&quot;ASWfPropertyNamesTable&quot;</span>] as AppFabricMonitoringDataSet.ASWfPropertyNamesTableDataTable<span style="color: #008000">;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span> <span style="color: #008000">AppFabricMonitoringDataSet.ASWfTrackingProfilesTableDataTable asWFTrackingProfilesTable =</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span> ds.Tables[<span style="color: #006080">&quot;ASWFTrackingProfilesTable&quot;</span>] as AppFabricMonitoringDataSet.ASWfTrackingProfilesTableDataTable;</pre>
<!--CRLF--></div>
</div>

<p align="justify"><font size="2">Before loading the data, we clear the temporary monitoring database.</font></p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> string conString = System.Configuration.ConfigurationManager.ConnectionStrings[<span style="color: #006080">&quot;WorkflowDesignerMonitoringDB ConnectionString&quot;</span>].ConnectionString<span style="color: #008000">;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> <span style="color: #008000">                System.Data.SqlClient.SqlConnection sqlCon = new System.Data.SqlClient.SqlConnection(conString);</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>  </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span> try</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span> sqlCon.Open()<span style="color: #008000">;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span> <span style="color: #008000">System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand();</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span> cmd.CommandText = <span style="color: #006080">&quot;TRUNCATE TABLE [ASWfTrackingProfilesTable]; &quot;</span> +</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span> <span style="color: #006080">&quot;TRUNCATE TABLE [ASWfEventPropertiesTable];&quot;</span> +</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span> <span style="color: #006080">&quot;TRUNCATE TABLE [ASWfPropertyNamesTable];&quot;</span> +</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11">  11:</span> <span style="color: #006080">&quot;TRUNCATE TABLE [ASWfInstancesTable];&quot;</span> +</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum12">  12:</span> <span style="color: #006080">&quot;TRUNCATE TABLE [ASWfEventsTable];&quot;</span> +</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum13">  13:</span> <span style="color: #006080">&quot;TRUNCATE TABLE [ASEventSourcesTable];&quot;</span><span style="color: #008000">;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum14">  14:</span> <span style="color: #008000">cmd.Connection = sqlCon;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum15">  15:</span> cmd.ExecuteNonQuery()<span style="color: #008000">;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum16">  16:</span> <span style="color: #008000">}</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum17">  17:</span> finally</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum18">  18:</span> {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum19">  19:</span> sqlCon.Close()<span style="color: #008000">;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum20">  20:</span> <span style="color: #008000">}</span></pre>
<!--CRLF--></div>
</div>

<p align="justify"><font size="2">We then set up a bulk insertion.</font></p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> System.Data.SqlClient.SqlBulkCopy sbc = new System.Data.SqlClient.SqlBulkCopy(conString,</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> System.Data.SqlClient.SqlBulkCopyOptions.KeepIdentity | System.Data.SqlClient.SqlBulkCopyOptions.FireTriggers)<span style="color: #008000">;</span></pre>
<!--CRLF--></div>
</div>

<p align="justify"><font size="2">Then we insert the records into the appropriate tables.</font></p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> BulkInsertTable(asWfEventsTable, sbc)<span style="color: #008000">;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> <span style="color: #008000">BulkInsertTable(asEventSourcesTable, sbc);</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span> BulkInsertTable(asWfEventPropertiesTable, sbc)<span style="color: #008000">;</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span> <span style="color: #008000">BulkInsertTable(asWfPropertyNamesTable, sbc);</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span> BulkInsertTable(asWFTrackingProfilesTable, sbc)<span style="color: #008000">;</span></pre>
<!--CRLF--></div>
</div>

<p align="justify"><font size="2"></font></p>

<p align="justify"><font size="2">Once the project and event data is loaded, the ISV Support Team can instantly reproduce the error scenario and troubleshoot the customer’s erroneous Workflow. The Support team has an exact copy of the customer's project with the state reproduced.</font></p>

<h1>Result</h1>

<p align="justify"><font size="2">Typically, .NET4 Workflows are difficult to debug since the event information relating to these Workflows is ‘hidden’ amongst OS and Server related events. With the advent of Windows Server AppFabric, this event data is now easily accessible from a simple database. Even the ISV's rudimentary Workflow Designer and Visualizer Applications can be designed to package this data for remote debugging. </font></p>

<p align="justify"><font size="2">The error example used in this blog post relates to a variable with the wrong format. While in the real world there will be many more complex use cases, this solution provides a reasonable platform to troubleshoot Workflows, especially in an offsite scenario.</font></p>

<p align="justify"><font size="2"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image005" border="0" alt="clip_image005" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/asgisv/WindowsLiveWriter/WindowsServerAppFabricExtensibilitytosup_A07B/clip_image005_33e3d989-59e2-41de-82a6-569847d4c15b.jpg" original-url="https://blogs.msdn.com/blogfiles/asgisv/WindowsLiveWriter/WindowsServerAppFabricExtensibilitytosup_A07B/clip_image005_33e3d989-59e2-41de-82a6-569847d4c15b.jpg" width="606" height="202" /></font></p>

<p align="justify"><font size="2">Once the error is ‘fixed’ the Workflow instance is flawlessly executed and can be verified on the Visualizer. </font></p>

<p align="justify"><font size="2"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image007" border="0" alt="clip_image007" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/asgisv/WindowsLiveWriter/WindowsServerAppFabricExtensibilitytosup_A07B/clip_image007_f6beffd8-a455-4c30-9966-9a1e17b85089.gif" original-url="https://blogs.msdn.com/blogfiles/asgisv/WindowsLiveWriter/WindowsServerAppFabricExtensibilitytosup_A07B/clip_image007_f6beffd8-a455-4c30-9966-9a1e17b85089.gif" width="606" height="283" /></font></p>

<h1>Summary</h1>

<p align="justify"><font size="2">Windows Server AppFabric provides adequate extensibility for the ISV to build applications that can efficiently manage the lifecycle of .NET4 Workflow Services. This blog post effectively demonstrates the extensibility around remote troubleshooting. </font></p>

<h1>Caveat </h1>

<p align="justify"><font size="2">The Workflow instances could contain sensitive and confidential data, event info etc. The ISV Application should include designs to obfuscate such information. </font></p>]]></content:encoded>
    </item>
    <item>
      <title>Troubleshooting BRE Policies Failing to Return Results</title>
      <link>https://docs.microsoft.com/archive/blogs/asgisv/troubleshooting-bre-policies-failing-to-return-results</link>
      <pubDate>Thu, 29 Apr 2010 14:14:17 GMT</pubDate>
      <dc:creator><![CDATA[ValeryM]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/asgisv/2010/04/29/troubleshooting-bre-policies-failing-to-return-results/</guid>
      <description><![CDATA[One of our BizTalk ISV partners recently bumped into an interesting behavioral aspect of the...]]></description>
      <content:encoded><![CDATA[<p>One of our BizTalk ISV partners recently bumped into an interesting behavioral aspect of the Business Rules Engine (BRE). Their experience deserved sharing it with the community. It is likely that other BizTalk developers might be facing with similar challenges, hence this post.</p>  <p>As part of the BRE adoption exercise, the ISV implemented a policy which included a static method call as depicted below.</p>  <p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="BRE Static Method Call" border="0" alt="BRE Static Method Call" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/asgisv/WindowsLiveWriter/TroubleshootingBREPoliciesFailingtoRetur_B93C/BRE%20Static%20Method%20Call_3.png" original-url="https://blogs.msdn.com/blogfiles/asgisv/WindowsLiveWriter/TroubleshootingBREPoliciesFailingtoRetur_B93C/BRE%20Static%20Method%20Call_3.png" width="640" height="398" />&#160;</p>  <p>Being new to the Business Rules Engine, the developer didn’t specify any BRE configuration settings in the <em>app.config</em> file, meaning that the entire <i><strong>&lt;Microsoft.RuleEngine&gt;</strong></i> section has been absent from the application configuration. When executing the above policy, the developer has not seen any exceptions and was led to believe that invocation was successful. However, the policy didn’t return any results. The developer has enabled the detailed tracing which confirmed that BRE policy completes successfully but none of the rules were fired.</p>  <p>&#160;<img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Untitled" border="0" alt="Untitled" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/asgisv/WindowsLiveWriter/TroubleshootingBREPoliciesFailingtoRetur_B93C/Untitled_3.png" original-url="https://blogs.msdn.com/blogfiles/asgisv/WindowsLiveWriter/TroubleshootingBREPoliciesFailingtoRetur_B93C/Untitled_3.png" width="640" height="320" /> </p>  <p></p>  <p>The developer had to spend some time to troubleshoot the above problem before concluding that it was related to a missing <i><a href="https://msdn.microsoft.com/en-us/library/aa548008(BTS.10).aspx" target="_blank"><strong>StaticSupport</strong></a></i> parameter. The Business Rules Engine requires the <em><strong>StaticSupport</strong></em> parameter to be defined in order to be able to invoke static members of a class without the need to assert an object of that class. If <strong><em>StaticSupport</em> </strong>is not present either in application configuration file or registry, the BRE policy containing a call to a static class member will be successfully executed but will not return any result. Unfortunately, there is currently no diagnostic information available to the developer to help identify why a policy doesn’t not return any results. </p>  <p>In order to resolve the issue, the developer modified the <em>app.config</em> file and added the following content:</p>  <p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image002" border="0" alt="clip_image002" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/asgisv/WindowsLiveWriter/TroubleshootingBREPoliciesFailingtoRetur_B93C/clip_image002_3.jpg" original-url="https://blogs.msdn.com/blogfiles/asgisv/WindowsLiveWriter/TroubleshootingBREPoliciesFailingtoRetur_B93C/clip_image002_3.jpg" width="640" height="91" /></p>  <p>After the above configuration parameter was added, the trace log confirmed that rules are being fired and the correct results are being returned:</p>  <p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="BRE Policy Trace with Static Method Call (With Results)" border="0" alt="BRE Policy Trace with Static Method Call (With Results)" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/asgisv/WindowsLiveWriter/TroubleshootingBREPoliciesFailingtoRetur_B93C/BRE%20Policy%20Trace%20with%20Static%20Method%20Call%20(With%20Results)_9.png" original-url="https://blogs.msdn.com/blogfiles/asgisv/WindowsLiveWriter/TroubleshootingBREPoliciesFailingtoRetur_B93C/BRE%20Policy%20Trace%20with%20Static%20Method%20Call%20(With%20Results)_9.png" width="640" height="384" /> </p>  <p>Although the <a href="https://technet.microsoft.com/en-us/library/aa950269(BTS.10).aspx" target="_blank">product documentation</a><strong></strong><strong>&#160;</strong>covers the static member invocation, our observations suggest that newbie BizTalk developers are likely to spend their valuable time troubleshooting the policy execution issues if they didn’t read the documentation from the beginning. This may negatively affect the developer experience which is what we would very much like to prevent.</p>  <p>In light of the above experience with BRE, we have advised the Product Group on the need for a better diagnostic of policy execution. This should make it easier for the developers to identify and resolve the BRE policy invocation issues when static methods are being used.</p>  <p>For more information on the related topic, please visit the following resources:</p>  <ul>   <li>&quot;<a href="https://technet.microsoft.com/en-us/library/aa950269(BTS.10).aspx" target="_blank">Invoking Static Members of a Class</a>&quot; article in the MSDN Documentation</li>    <li>&quot;<a href="https://geekswithblogs.net/cyoung/articles/111169.aspx" target="_blank">MS BRE: Controlling rule side effects</a>&quot; post on Charles Young's blog</li>    <li>&quot;<a href="https://blogs.msdn.com/richardbpi/archive/2005/11/14/492489.aspx" target="_blank">BizTalk Server 2006 Business Rules and Static Methods</a>&quot; article on Richard Seroter's blog</li> </ul>  <p>Please share any feedback that you may have. Thanks.</p>]]></content:encoded>
    </item>
  </channel>
</rss>