<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Random ramblings about Technology</title><link>http://blogs.msdn.com/b/martijnh/</link><description /><dc:language>en-US</dc:language><generator>Telligent Community 5.6.583.17018 (Build: 5.6.583.17018)</generator><item><title>SQL Server–HOW-TO: quickly retrieve accurate row count for table</title><link>http://blogs.msdn.com/b/martijnh/archive/2010/07/15/sql-server-how-to-quickly-retrieve-accurate-row-count-for-table.aspx</link><pubDate>Thu, 15 Jul 2010 20:24:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10038823</guid><dc:creator>martijnh1</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/martijnh/rsscomments.aspx?WeblogPostID=10038823</wfw:commentRss><comments>http://blogs.msdn.com/b/martijnh/archive/2010/07/15/sql-server-how-to-quickly-retrieve-accurate-row-count-for-table.aspx#comments</comments><description>&lt;p&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;Recently, I&amp;rsquo;ve been involved in a very interesting project in which we need to perform operations on a table containing 3,000,000,000+ rows. For some tooling, I needed a quick and reliable way to count the number of rows contained within this table. Performing a simple &lt;/span&gt;&lt;/p&gt;
&lt;p style="line-height: normal; margin: 0in 0in 0pt;" class="MsoNormal"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;&lt;span style="font-size: small;" size="3"&gt;&lt;span style="font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;SELECT&lt;/span&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt;"&gt; &lt;span style="color: fuchsia;"&gt;COUNT&lt;/span&gt;&lt;span style="color: gray;"&gt;(*)&lt;/span&gt; &lt;span style="color: blue;"&gt;FROM&lt;/span&gt; Transactions&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="line-height: normal; margin: 0in 0in 0pt;" class="MsoNormal"&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;operation would do the trick on small tables with low IO, but what&amp;rsquo;s the &amp;lsquo;best&amp;rsquo; way (quick and reliable) to perform this operation on large tables?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;I searched and found different answers, which I note here so it might be of use to someone&amp;hellip; (My table was called &amp;lsquo;Transactions&amp;rsquo;)&lt;/span&gt;&lt;/p&gt;
&lt;table style="width: 500px; border-collapse: collapse; mso-yfti-tbllook: 1184; mso-padding-alt: 0cm 0cm 0cm 0cm;" class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0"&gt;
&lt;tbody&gt;
&lt;tr style="mso-yfti-irow: 0; mso-yfti-firstrow: yes;"&gt;
&lt;td style="border-bottom: #d4d0c8 1pt inset; border-left: #4f81bd 1pt solid; width: 4.42%; background: #4f81bd; border-top: #4f81bd 1pt solid; border-right: #d4d0c8 1pt inset; mso-border-top-alt: solid #4f81bd 1.0pt; mso-border-left-alt: solid #4f81bd 1.0pt; mso-border-bottom-alt: inset #d4d0c8 .75pt; mso-border-right-alt: inset #d4d0c8 .75pt; padding: 0cm;" valign="top" width="4%"&gt;
&lt;p style="line-height: normal; margin: 0cm 0cm 0pt;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="color: white; font-size: 12pt; mso-ascii-font-family: calibri; mso-fareast-font-family: 'Times New Roman'; mso-hansi-font-family: calibri; mso-bidi-font-family: calibri; mso-fareast-language: nl;"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;Index &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="background: url('/controlpanel/blogs/posteditor.aspx/none') #4f81bd; padding: 0cm 5.4pt; border: 1px solid #f0f0f0; width: 30%; mso-border-top-alt: solid #4f81bd 1.0pt; mso-border-left-alt: solid #4f81bd 1.0pt; mso-border-bottom-alt: inset #d4d0c8 .75pt; mso-border-right-alt: inset #d4d0c8 .75pt;" valign="top"&gt;
&lt;p style="line-height: normal; margin: 0cm 0cm 0pt;" class="MsoNormal"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;&lt;b&gt;&lt;span style="color: white; font-size: 12pt; mso-ascii-font-family: calibri; mso-fareast-font-family: 'Times New Roman'; mso-hansi-font-family: calibri; mso-bidi-font-family: calibri; mso-fareast-language: nl;"&gt;Query &lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: 'Times New Roman','serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="border-bottom: #d4d0c8 1pt inset; padding-bottom: 0cm; padding-left: 5.4pt; width: 43.92%; padding-right: 5.4pt; background: #4f81bd; border-left-color: #f0f0f0; border-top: #4f81bd 1pt solid; border-right: #4f81bd 1pt solid; padding-top: 0cm; mso-border-top-alt: solid #4f81bd 1.0pt; mso-border-left-alt: inset #d4d0c8 .75pt; mso-border-bottom-alt: inset #d4d0c8 .75pt; mso-border-right-alt: solid #4f81bd 1.0pt;" valign="top" width="552"&gt;
&lt;p style="line-height: normal; margin: 0cm 0cm 0pt;" class="MsoNormal"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;&lt;b&gt;&lt;span style="color: white; font-size: 12pt; mso-ascii-font-family: calibri; mso-fareast-font-family: 'Times New Roman'; mso-hansi-font-family: calibri; mso-bidi-font-family: calibri; mso-fareast-language: nl;"&gt;Comment&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: 'Times New Roman','serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="mso-yfti-irow: 1;"&gt;
&lt;td style="border-bottom: #4f81bd 1pt solid; border-left: #4f81bd 1pt solid; background-color: transparent; border-top-color: #f0f0f0; width: 4.42%; border-right: #d4d0c8 1pt inset; mso-border-top-alt: solid #4f81bd 1.0pt; mso-border-right-alt: inset #d4d0c8 .75pt; mso-border-alt: solid #4f81bd 1.0pt; padding: 0cm;" valign="top" width="4%"&gt;
&lt;p style="line-height: normal; margin: 0cm 0cm 0pt;" class="MsoNormal"&gt;&lt;span style="font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: calibri; mso-fareast-language: nl; mso-bidi-theme-font: minor-latin;"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;1 &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="border-bottom: #4f81bd 1pt solid; padding-bottom: 0cm; background-color: transparent; border-top-color: #f0f0f0; padding-left: 5.4pt; width: 51.66%; padding-right: 5.4pt; border-left-color: #f0f0f0; border-right: #d4d0c8 1pt inset; padding-top: 0cm; mso-border-top-alt: solid #4f81bd 1.0pt; mso-border-left-alt: solid #4f81bd 1.0pt; mso-border-right-alt: inset #d4d0c8 .75pt; mso-border-alt: solid #4f81bd 1.0pt;" valign="top" width="51%"&gt;
&lt;p style="line-height: normal; margin: 0cm 0cm 0pt;" class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: blue; font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl;"&gt;SELECT&lt;/span&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl;"&gt; &lt;span style="color: fuchsia;"&gt;COUNT&lt;/span&gt;&lt;span style="color: gray;"&gt;(*)&lt;/span&gt; &lt;span style="color: blue;"&gt;FROM&lt;/span&gt; Transactions&lt;/span&gt;&lt;span style="font-family: 'Times New Roman','serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl;"&gt; &lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="border-bottom: #4f81bd 1pt solid; padding-bottom: 0cm; background-color: transparent; border-top-color: #f0f0f0; padding-left: 5.4pt; width: 43.92%; padding-right: 5.4pt; border-left-color: #f0f0f0; border-right: #4f81bd 1pt solid; padding-top: 0cm; mso-border-top-alt: solid #4f81bd 1.0pt; mso-border-left-alt: inset #d4d0c8 .75pt;" valign="top" width="552"&gt;
&lt;p style="line-height: normal; margin: 0cm 0cm 0pt;" class="MsoNormal"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;&lt;span style="font-size: 12pt; mso-ascii-font-family: calibri; mso-fareast-font-family: 'Times New Roman'; mso-hansi-font-family: calibri; mso-bidi-font-family: calibri; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt;Performs a full table scan. &lt;/span&gt;&lt;span style="font-size: 12pt; mso-ascii-font-family: calibri; mso-fareast-font-family: 'Times New Roman'; mso-hansi-font-family: calibri; mso-bidi-font-family: calibri; mso-fareast-language: nl;"&gt;Slow on large tables.&lt;/span&gt;&lt;span style="font-family: 'Times New Roman','serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="mso-yfti-irow: 2;"&gt;
&lt;td style="border-bottom: #d4d0c8 1pt inset; border-left: #4f81bd 1pt solid; background-color: transparent; border-top-color: #f0f0f0; width: 4.42%; border-right: #d4d0c8 1pt inset; mso-border-top-alt: inset #d4d0c8 .75pt; mso-border-left-alt: solid #4f81bd 1.0pt; mso-border-alt: inset #d4d0c8 .75pt; padding: 0cm;" valign="top" width="4%"&gt;
&lt;p style="line-height: normal; margin: 0cm 0cm 0pt;" class="MsoNormal"&gt;&lt;span style="font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: calibri; mso-fareast-language: nl; mso-bidi-theme-font: minor-latin; mso-ansi-language: en-us;" lang="EN-US"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;2 &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="border-bottom: #d4d0c8 1pt inset; padding-bottom: 0cm; background-color: transparent; border-top-color: #f0f0f0; padding-left: 5.4pt; width: 51.66%; padding-right: 5.4pt; border-left-color: #f0f0f0; border-right: #d4d0c8 1pt inset; padding-top: 0cm; mso-border-top-alt: inset #d4d0c8 .75pt; mso-border-left-alt: solid #4f81bd 1.0pt; mso-border-alt: inset #d4d0c8 .75pt;" valign="top" width="51%"&gt;
&lt;p style="line-height: normal; margin: 0cm 0cm 0pt;" class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: blue; font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt;SELECT&lt;/span&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt; &lt;span style="color: fuchsia;"&gt;CONVERT&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;&lt;span style="color: blue;"&gt;bigint&lt;/span&gt;&lt;span style="color: gray;"&gt;,&lt;/span&gt; &lt;span style="color: blue;"&gt;rows&lt;/span&gt;&lt;span style="color: gray;"&gt;)&lt;/span&gt; &lt;/span&gt;&lt;span style="font-family: 'Times New Roman','serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="line-height: normal; margin: 0cm 0cm 0pt;" class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: blue; font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt;FROM&lt;/span&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt; &lt;span style="color: green;"&gt;sysindexes&lt;/span&gt; &lt;/span&gt;&lt;span style="font-family: 'Times New Roman','serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="line-height: normal; margin: 0cm 0cm 0pt;" class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: blue; font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt;WHERE&lt;/span&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt; id &lt;span style="color: gray;"&gt;=&lt;/span&gt; &lt;span style="color: fuchsia;"&gt;OBJECT_ID&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;&lt;span style="color: red;"&gt;'Transactions'&lt;/span&gt;&lt;span style="color: gray;"&gt;)&lt;/span&gt; &lt;/span&gt;&lt;span style="font-family: 'Times New Roman','serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="line-height: normal; margin: 0cm 0cm 0pt;" class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: gray; font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl;"&gt;AND&lt;/span&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl;"&gt; indid &lt;span style="color: gray;"&gt;&amp;lt;&lt;/span&gt; 2&lt;/span&gt;&lt;span style="font-family: 'Times New Roman','serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl;"&gt; &lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="border-bottom: #d4d0c8 1pt inset; padding-bottom: 0cm; background-color: transparent; border-top-color: #f0f0f0; padding-left: 5.4pt; width: 43.92%; padding-right: 5.4pt; border-left-color: #f0f0f0; border-right: #4f81bd 1pt solid; padding-top: 0cm; mso-border-top-alt: inset #d4d0c8 .75pt; mso-border-left-alt: inset #d4d0c8 .75pt; mso-border-right-alt: solid #4f81bd 1.0pt; mso-border-alt: inset #d4d0c8 .75pt;" valign="top" width="552"&gt;
&lt;p style="line-height: normal; margin: 0cm 0cm 0pt;" class="MsoNormal"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;&lt;span style="font-size: 12pt; mso-ascii-font-family: calibri; mso-fareast-font-family: 'Times New Roman'; mso-hansi-font-family: calibri; mso-bidi-font-family: calibri; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt;Fast way to retrieve row count. Depends on statistics and is inaccurate.&lt;/span&gt;&lt;span style="font-family: 'Times New Roman','serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="line-height: normal; margin: 0cm 0cm 0pt;" class="MsoNormal"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;&lt;span style="font-size: 12pt; mso-ascii-font-family: calibri; mso-fareast-font-family: 'Times New Roman'; mso-hansi-font-family: calibri; mso-bidi-font-family: calibri; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt;Run DBCC UPDATEUSAGE(Database) WITH COUNT_ROWS, which can take significant time for large tables.&lt;/span&gt;&lt;span style="font-family: 'Times New Roman','serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="mso-yfti-irow: 3;"&gt;
&lt;td style="border-bottom: #4f81bd 1pt solid; border-left: #4f81bd 1pt solid; background-color: transparent; border-top-color: #f0f0f0; width: 4.42%; border-right: #d4d0c8 1pt inset; mso-border-top-alt: solid #4f81bd 1.0pt; mso-border-right-alt: inset #d4d0c8 .75pt; mso-border-alt: solid #4f81bd 1.0pt; padding: 0cm;" valign="top" width="4%"&gt;
&lt;p style="line-height: normal; margin: 0cm 0cm 0pt;" class="MsoNormal"&gt;&lt;span style="font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: calibri; mso-fareast-language: nl; mso-bidi-theme-font: minor-latin; mso-ansi-language: en-us;" lang="EN-US"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;3 &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="border-bottom: #4f81bd 1pt solid; padding-bottom: 0cm; background-color: transparent; border-top-color: #f0f0f0; padding-left: 5.4pt; width: 51.66%; padding-right: 5.4pt; border-left-color: #f0f0f0; border-right: #d4d0c8 1pt inset; padding-top: 0cm; mso-border-top-alt: solid #4f81bd 1.0pt; mso-border-left-alt: solid #4f81bd 1.0pt; mso-border-right-alt: inset #d4d0c8 .75pt; mso-border-alt: solid #4f81bd 1.0pt;" valign="top" width="51%"&gt;
&lt;p style="line-height: normal; margin: 0cm 0cm 0pt;" class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: blue; font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt;SELECT&lt;/span&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt; &lt;span style="color: fuchsia;"&gt;CAST&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;p&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: blue;"&gt;rows&lt;/span&gt; &lt;span style="color: blue;"&gt;AS&lt;/span&gt; &lt;span style="color: blue;"&gt;float&lt;/span&gt;&lt;span style="color: gray;"&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 'Times New Roman','serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p style="line-height: normal; margin: 0cm 0cm 0pt;" class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: blue; font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt;FROM&lt;/span&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt; &lt;span style="color: green;"&gt;sys&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: green;"&gt;tables&lt;/span&gt; &lt;span style="color: blue;"&gt;AS&lt;/span&gt; tbl &lt;/span&gt;&lt;span style="font-family: 'Times New Roman','serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="line-height: normal; margin: 0cm 0cm 0pt;" class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: gray; font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt;INNER&lt;/span&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt; &lt;span style="color: gray;"&gt;JOIN&lt;/span&gt; &lt;span style="color: green;"&gt;sys&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: green;"&gt;indexes&lt;/span&gt; &lt;span style="color: blue;"&gt;AS&lt;/span&gt; idx &lt;span style="color: blue;"&gt;ON&lt;/span&gt; idx&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: fuchsia;"&gt;object_id&lt;/span&gt; &lt;span style="color: gray;"&gt;=&lt;/span&gt; tbl&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: fuchsia;"&gt;object_id&lt;/span&gt; &lt;span style="color: gray;"&gt;and&lt;/span&gt; idx&lt;span style="color: gray;"&gt;.&lt;/span&gt;index_id &lt;span style="color: gray;"&gt;&amp;lt;&lt;/span&gt; 2&lt;/span&gt;&lt;span style="font-family: 'Times New Roman','serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p style="line-height: normal; margin: 0cm 0cm 0pt;" class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: gray; font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt;INNER&lt;/span&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt; &lt;span style="color: gray;"&gt;JOIN&lt;/span&gt; &lt;span style="color: green;"&gt;sys&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: green;"&gt;partitions&lt;/span&gt; &lt;span style="color: blue;"&gt;AS&lt;/span&gt; p &lt;span style="color: blue;"&gt;ON&lt;/span&gt; p&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: fuchsia;"&gt;object_id&lt;/span&gt;&lt;span style="color: gray;"&gt;=&lt;/span&gt;&lt;span style="color: fuchsia;"&gt;CAST&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;tbl&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: fuchsia;"&gt;object_id&lt;/span&gt; &lt;span style="color: blue;"&gt;AS&lt;/span&gt; &lt;span style="color: blue;"&gt;int&lt;/span&gt;&lt;span style="color: gray;"&gt;)&lt;/span&gt; &lt;/span&gt;&lt;span style="font-family: 'Times New Roman','serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="line-height: normal; margin: 0cm 0cm 0pt;" class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: gray; font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt;AND&lt;/span&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt; p&lt;span style="color: gray;"&gt;.&lt;/span&gt;index_id&lt;span style="color: gray;"&gt;=&lt;/span&gt;idx&lt;span style="color: gray;"&gt;.&lt;/span&gt;index_id&lt;/span&gt;&lt;span style="font-family: 'Times New Roman','serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p style="line-height: normal; margin: 0cm 0cm 0pt;" class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: blue; font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt;WHERE &lt;/span&gt;&lt;span style="font-family: 'Courier New'; color: gray; font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt;((&lt;/span&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt;tbl&lt;span style="color: gray;"&gt;.&lt;/span&gt;name&lt;span style="color: gray;"&gt;=&lt;/span&gt;&lt;span style="color: red;"&gt;N'Transactions'&lt;/span&gt; &lt;/span&gt;&lt;span style="font-family: 'Times New Roman','serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="line-height: normal; margin: 0cm 0cm 0pt;" class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: gray; font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt;AND&lt;/span&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt; &lt;span style="color: fuchsia;"&gt;SCHEMA_NAME&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;tbl&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: fuchsia;"&gt;schema_id&lt;/span&gt;&lt;span style="color: gray;"&gt;)=&lt;/span&gt;&lt;span style="color: red;"&gt;'dbo'&lt;/span&gt;&lt;span style="color: gray;"&gt;))&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 'Times New Roman','serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt; &lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="border-bottom: #4f81bd 1pt solid; padding-bottom: 0cm; background-color: transparent; border-top-color: #f0f0f0; padding-left: 5.4pt; width: 43.92%; padding-right: 5.4pt; border-left-color: #f0f0f0; border-right: #4f81bd 1pt solid; padding-top: 0cm; mso-border-top-alt: solid #4f81bd 1.0pt; mso-border-left-alt: inset #d4d0c8 .75pt;" valign="top" width="552"&gt;
&lt;p style="line-height: normal; margin: 0cm 0cm 0pt;" class="MsoNormal"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;&lt;span style="font-size: 12pt; mso-ascii-font-family: calibri; mso-fareast-font-family: 'Times New Roman'; mso-hansi-font-family: calibri; mso-bidi-font-family: calibri; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt;The way the SQL management studio counts rows (look at table properties, storage, row count). &lt;/span&gt;&lt;span style="font-size: 12pt; mso-ascii-font-family: calibri; mso-fareast-font-family: 'Times New Roman'; mso-hansi-font-family: calibri; mso-bidi-font-family: calibri; mso-fareast-language: nl;"&gt;Very fast, but still an approximate number of rows.&lt;/span&gt;&lt;span style="font-family: 'Times New Roman','serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style="mso-yfti-irow: 4; mso-yfti-lastrow: yes;"&gt;
&lt;td style="border-bottom: #4f81bd 1pt solid; border-left: #4f81bd 1pt solid; background-color: transparent; border-top-color: #f0f0f0; width: 4.42%; border-right: #d4d0c8 1pt inset; mso-border-top-alt: inset #d4d0c8 .75pt; mso-border-left-alt: solid #4f81bd 1.0pt; mso-border-bottom-alt: solid #4f81bd 1.0pt; mso-border-right-alt: inset #d4d0c8 .75pt; padding: 0cm;" valign="top" width="4%"&gt;
&lt;p style="line-height: normal; margin: 0cm 0cm 0pt;" class="MsoNormal"&gt;&lt;span style="font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: calibri; mso-fareast-language: nl; mso-bidi-theme-font: minor-latin; mso-ansi-language: en-us;" lang="EN-US"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;4 &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="border-bottom: #4f81bd 1pt solid; padding-bottom: 0cm; background-color: transparent; border-top-color: #f0f0f0; padding-left: 5.4pt; width: 51.66%; padding-right: 5.4pt; border-left-color: #f0f0f0; border-right: #d4d0c8 1pt inset; padding-top: 0cm; mso-border-top-alt: inset #d4d0c8 .75pt; mso-border-left-alt: solid #4f81bd 1.0pt; mso-border-bottom-alt: solid #4f81bd 1.0pt; mso-border-right-alt: inset #d4d0c8 .75pt;" valign="top" width="51%"&gt;
&lt;p style="line-height: normal; margin: 0cm 0cm 0pt;" class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: blue; font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt;SELECT&lt;/span&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt; &lt;span style="color: fuchsia;"&gt;SUM&lt;/span&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;row_count&lt;span style="color: gray;"&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 'Times New Roman','serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p style="line-height: normal; margin: 0cm 0cm 0pt;" class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: blue; font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt;FROM&lt;/span&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt; &lt;span style="color: green;"&gt;sys&lt;/span&gt;&lt;span style="color: gray;"&gt;.&lt;/span&gt;&lt;span style="color: green;"&gt;dm_db_partition_stats&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 'Times New Roman','serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p style="line-height: normal; margin: 0cm 0cm 0pt;" class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: blue; font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt;WHERE&lt;/span&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt; &lt;span style="color: fuchsia;"&gt;object_id&lt;/span&gt;&lt;span style="color: gray;"&gt;=&lt;/span&gt;&lt;span style="color: fuchsia;"&gt;OBJECT_ID&lt;/span&gt;&lt;span style="color: gray;"&gt;(&lt;/span&gt;&lt;span style="color: red;"&gt;'Transactions'&lt;/span&gt;&lt;span style="color: gray;"&gt;)&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="font-family: 'Times New Roman','serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="line-height: normal; margin: 0cm 0cm 0pt;" class="MsoNormal"&gt;&lt;span style="font-family: 'Courier New'; color: gray; font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt;AND&lt;/span&gt;&lt;span style="font-family: 'Courier New'; color: blue; font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt; &lt;/span&gt;&lt;span style="font-family: 'Courier New'; color: gray; font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt;(&lt;/span&gt;&lt;span style="font-family: 'Courier New'; font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt;index_id&lt;span style="color: gray;"&gt;=&lt;/span&gt;0 &lt;span style="color: gray;"&gt;or&lt;/span&gt; index_id&lt;span style="color: gray;"&gt;=&lt;/span&gt;1&lt;span style="color: gray;"&gt;);&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 'Times New Roman','serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt; &lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;td style="border-bottom: #4f81bd 1pt solid; padding-bottom: 0cm; background-color: transparent; border-top-color: #f0f0f0; padding-left: 5.4pt; width: 43.92%; padding-right: 5.4pt; border-left-color: #f0f0f0; border-right: #4f81bd 1pt solid; padding-top: 0cm; mso-border-top-alt: inset #d4d0c8 .75pt; mso-border-left-alt: inset #d4d0c8 .75pt;" valign="top" width="552"&gt;
&lt;p style="line-height: normal; margin: 0cm 0cm 0pt;" class="MsoNormal"&gt;&lt;span style="font-size: 12pt; mso-ascii-font-family: calibri; mso-fareast-font-family: 'Times New Roman'; mso-hansi-font-family: calibri; mso-bidi-font-family: calibri; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt;&lt;span style="font-family: Calibri;" face="Calibri"&gt;Quick (although not as fast as method 2) operation and equally important, reliable.&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 'Times New Roman','serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-language: nl; mso-ansi-language: en-us;" lang="EN-US"&gt; &lt;/span&gt;&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10038823" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/martijnh/archive/tags/SQL+Server/">SQL Server</category></item><item><title>SQL Server 2008 R2 - generating INSERT statements for a table</title><link>http://blogs.msdn.com/b/martijnh/archive/2010/06/24/sql-server-2008-r2-generating-insert-statements-for-a-table.aspx</link><pubDate>Thu, 24 Jun 2010 12:19:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10029562</guid><dc:creator>martijnh1</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/martijnh/rsscomments.aspx?WeblogPostID=10029562</wfw:commentRss><comments>http://blogs.msdn.com/b/martijnh/archive/2010/06/24/sql-server-2008-r2-generating-insert-statements-for-a-table.aspx#comments</comments><description>&lt;p&gt;Learned something new today. Maybe it’s well-known, but new to me, you can just run “C:\Program Files (x86)\Microsoft SQL Server\90\Tools\Publishing\1.4\SqlPubWiz.exe”. This nifty little tool can generate INSERT script very easily. Pictures tell the story :)&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:bd9da216-6119-43a0-a978-19dfec741f8b" class="wlWriterEditableSmartContent"&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-77-64-metablogapi/2248.dbp_5F00_001_2D00_8x6.png" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-77-64-metablogapi/0763.dbp_5F00_001.png" width="335" height="306" /&gt;&lt;/a&gt;&lt;/div&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:540bd78b-61d0-4ab3-8ae1-a8e61120b7f2" class="wlWriterEditableSmartContent"&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-77-64-metablogapi/2728.dbp_5F00_002_2D00_8x6.png" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-77-64-metablogapi/2744.dbp_5F00_002.png" width="335" height="306" /&gt;&lt;/a&gt;&lt;/div&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:6f170cec-29f5-4efb-afbc-ec43a0b32ebb" class="wlWriterEditableSmartContent"&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-77-64-metablogapi/0216.dbp_5F00_003_2D00_8x6.png" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-77-64-metablogapi/0601.dbp_5F00_003.png" width="335" height="306" /&gt;&lt;/a&gt;&lt;/div&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:c4d2b2f7-cf69-4bfa-b25b-39ffb9ab1072" class="wlWriterEditableSmartContent"&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-77-64-metablogapi/4010.dbp_5F00_004_2D00_8x6.png" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-77-64-metablogapi/1780.dbp_5F00_004.png" width="335" height="306" /&gt;&lt;/a&gt;&lt;/div&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:201f364e-aa74-49df-9371-37fff6d64503" class="wlWriterEditableSmartContent"&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-77-64-metablogapi/0131.dbp_5F00_005_2D00_8x6.png" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-77-64-metablogapi/4846.dbp_5F00_005.png" width="335" height="306" /&gt;&lt;/a&gt;&lt;/div&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:4ebb36f2-e2ec-498a-bba1-82c9f82c71c5" class="wlWriterEditableSmartContent"&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-77-64-metablogapi/7802.dbp_5F00_006_2D00_8x6.png" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-77-64-metablogapi/0045.dbp_5F00_006.png" width="335" height="306" /&gt;&lt;/a&gt;&lt;/div&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:41df9971-07d3-4677-9743-461f6e925a86" class="wlWriterEditableSmartContent"&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-77-64-metablogapi/3386.dbp_5F00_007_2D00_8x6.png" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-77-64-metablogapi/2625.dbp_5F00_007.png" width="335" height="306" /&gt;&lt;/a&gt;&lt;/div&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:7b016c2c-d2d9-40d9-a875-e28d1a16711e" class="wlWriterEditableSmartContent"&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-77-64-metablogapi/3201.dbp_5F00_008_2D00_8x6.png" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-77-64-metablogapi/6443.dbp_5F00_008.png" width="335" height="312" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10029562" width="1" height="1"&gt;</description></item><item><title>Reading MSMQ from within SSIS packages</title><link>http://blogs.msdn.com/b/martijnh/archive/2010/06/10/reading-msmq-from-within-ssis-packages.aspx</link><pubDate>Thu, 10 Jun 2010 19:54:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10023149</guid><dc:creator>martijnh1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/martijnh/rsscomments.aspx?WeblogPostID=10023149</wfw:commentRss><comments>http://blogs.msdn.com/b/martijnh/archive/2010/06/10/reading-msmq-from-within-ssis-packages.aspx#comments</comments><description>&lt;p&gt;Recently, I had to implement an SSIS package which imports some data into SQL Server from MSMQ. It turns out reading MSMQ from within an SSIS package is more difficult than it seems at first. I’ve documented how to get things working because I could find little other documentation.&lt;/p&gt;  &lt;p&gt;When reading data from MSMQ, there’s multiple steps to take:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Setting up a queue, if not yet available &lt;/li&gt;    &lt;li&gt;Set up a connection with MSMQ by adding a connection manager to the SSIS package &lt;/li&gt;    &lt;li&gt;Adding and configuring a Message Queue Task &lt;/li&gt;    &lt;li&gt;Putting data onto the queue &lt;/li&gt;    &lt;li&gt;Running the package to validate the data is read from the queue &lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;Setting up a queue&lt;/h3&gt;  &lt;p&gt;In Windows Server (2008 R2 in my case), create a new queue. It doesn’t really matter whether this queue is transactional or not.&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:229cb04c-4abc-4c0a-b6eb-eb7570a00d9f" class="wlWriterEditableSmartContent"&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-77-64-metablogapi/1323.msmqqueue_2D00_8x6.png" title="The created queue" rel="thumbnail"&gt;&lt;img border="0" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-77-64-metablogapi/8512.msmqqueue_5F00_3.png" width="420" height="368" /&gt;&lt;/a&gt;&lt;/div&gt;  &lt;h3&gt;Setting up a connection with MSMQ from within an SSIS package&lt;/h3&gt;  &lt;p&gt;First things first, let’s start with setting up a connection manager for MSMQ. When creating a new SSIS package, this is the view you get:&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:3579f335-96b8-476a-b32e-ef696bfca9ac" class="wlWriterEditableSmartContent"&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-77-64-metablogapi/7041.connectionmanager_2D00_8x6.png" title="Adding a connection manager" rel="thumbnail"&gt;&lt;img border="0" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-77-64-metablogapi/1780.connectionmanager_5F00_18.png" width="580" height="297" /&gt;&lt;/a&gt;&lt;/div&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;In the “Connection Managers” area, right-click and choose “new connection”. From the list that is displayed, select the “MSMQ” type and click “Add”.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:0de26ffd-4772-4fb1-8fbf-fe89286936dd" class="wlWriterEditableSmartContent"&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-77-64-metablogapi/6560.msmqconnectionmanager_2D00_8x6.png" title="Choosing which connection manager to use" rel="thumbnail"&gt;&lt;img border="0" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-77-64-metablogapi/1207.msmqconnectionmanager_5F00_3.png" width="389" height="449" /&gt;&lt;/a&gt;&lt;/div&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;A new dialog pops up, in which you can configure the connection to be made. I choose “.\Private$\mh” (a local queue called “mh”). Click “Test” to ensure the connection can be made and click “OK”.&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:381ddcf8-e139-47c1-9926-5aa7eb71b20c" class="wlWriterEditableSmartContent"&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-77-64-metablogapi/5775.msmqconnectionmanagerconnection_2D00_8x6.png" title="Configuring the connection manager" rel="thumbnail"&gt;&lt;img border="0" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-77-64-metablogapi/1588.msmqconnectionmanagerconnection_5F00_5.png" width="420" height="297" /&gt;&lt;/a&gt;&lt;/div&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;The connection manager is set up.&lt;/p&gt;  &lt;h3&gt;Adding a Message Queue Task&lt;/h3&gt;  &lt;p&gt;Adding a Message Queue task to the Control Flow is easy, drag and drop it from the Toolbox on the left (press CTRL-ALT-X if it’s not displayed) to the Control Flow surface, like displayed below.&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:312677e8-14fb-4955-8526-cbf8955e1229" class="wlWriterEditableSmartContent"&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-77-64-metablogapi/3666.msmqtask_2D00_8x6.png" title="Adding a Message Queue Task" rel="thumbnail"&gt;&lt;img border="0" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-77-64-metablogapi/7317.msmqtask_5F00_4.png" width="580" height="397" /&gt;&lt;/a&gt;&lt;/div&gt;  &lt;p&gt;To configure the Message Queue Task, double-click the Message Queue task’s icon on the left of the Task in the Control Flow. A new dialog pops up in which we’ll configure the task. Select the connection manager we set up previously for the “MSMQConnection” property within the dialog and change the default “Send message” value for the “Message” property to “Receive message”.&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:023f4d85-28f4-4f25-98f5-866a984ab5e8" class="wlWriterEditableSmartContent"&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-77-64-metablogapi/2538.msmqtaskconfig_5F00_01_2D00_8x6.png" title="Setting general properties for the Message Queue Task" rel="thumbnail"&gt;&lt;img border="0" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-77-64-metablogapi/1884.msmqtaskconfig_5F00_01_5F00_8.png" width="580" height="410" /&gt;&lt;/a&gt;&lt;/div&gt;  &lt;p&gt;Change to the “Receive” configuration page by click “Receive” on the left-hand side of the dialog. Choose whether the message should be removed from the queue after it is read by SSIS. I’ve chosen not to timeout reading the queue. Set the “MessageType” property to “String message to variable”. &lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:1a7fe1a2-d552-402c-af3c-43eac42a588f" class="wlWriterEditableSmartContent"&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-77-64-metablogapi/8838.msmqtaskconfig_5F00_02_2D00_8x6.png" title="Setting the receive properties for the Message Queue Task" rel="thumbnail"&gt;&lt;img border="0" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-77-64-metablogapi/3808.msmqtaskconfig_5F00_02_5F00_4.png" width="580" height="440" /&gt;&lt;/a&gt;&lt;/div&gt;  &lt;p&gt;Click on the drop-down for the “Variable” property and choose “New variable&amp;quot;. This will show a new dialog, in which a new variable can be defined. For this example, let’s use the information shown below and click “OK”.&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:b8f0500d-230e-459a-9bdb-78d34d25ac9b" class="wlWriterEditableSmartContent"&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-77-64-metablogapi/7711.msmqtaskconfig_5F00_02a_2D00_8x6.png" title="Creating a new variable in which the inbound message will be stored" rel="thumbnail"&gt;&lt;img border="0" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-77-64-metablogapi/0285.msmqtaskconfig_5F00_02a_5F00_3.png" width="580" height="554" /&gt;&lt;/a&gt;&lt;/div&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;After closing the dialog, we’ll be returned to the “Message Queue Task editor” dialog, which shows the newly created variable.&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:f06eaae5-6649-4264-84db-01811c55afec" class="wlWriterEditableSmartContent"&gt;&lt;a href="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-77-64-metablogapi/6661.msmqtaskconfig_5F00_02b_2D00_8x6.png" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-77-64-metablogapi/2620.msmqtaskconfig_5F00_02b_5F00_3.png" width="580" height="411" /&gt;&lt;/a&gt;&lt;/div&gt;  &lt;p&gt;The Message Queue Task is configured to read messages from the “.\Private$\mh” queue.&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;h3&gt;Putting data onto the queue&lt;/h3&gt;  &lt;p&gt;&lt;strong&gt;&lt;font color="#ff0000"&gt;For SSIS to be able to read the queue, ensure you label everything you put onto the queue with the label ‘String message’. If you don’t the message will not be picked up by SSIS.&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;h3&gt;Validation the package&lt;/h3&gt;  &lt;p&gt;Pressing F-5 (Debug) from within the Business Intelligence Development Studio will run the package, effectively picking up a message from the queue if there is any.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;HTH, happy trails!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10023149" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/martijnh/archive/tags/SSIS/">SSIS</category><category domain="http://blogs.msdn.com/b/martijnh/archive/tags/MSMQ/">MSMQ</category></item><item><title>TFS 2010 beta 2: connecting from Visual Studio 2008</title><link>http://blogs.msdn.com/b/martijnh/archive/2010/01/11/tfs-2010-beta-2-connecting-from-visual-studio-2008.aspx</link><pubDate>Mon, 11 Jan 2010 10:52:59 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9946465</guid><dc:creator>martijnh1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/martijnh/rsscomments.aspx?WeblogPostID=9946465</wfw:commentRss><comments>http://blogs.msdn.com/b/martijnh/archive/2010/01/11/tfs-2010-beta-2-connecting-from-visual-studio-2008.aspx#comments</comments><description>&lt;p&gt;Connecting to Team Foundation Server 2010 beta 2 from Visual Studio 2008 is easy: from Team Explorer, type the full URL in the "add server" dialog, e.g.:&lt;/p&gt; &lt;p&gt;&lt;a href="http://mytfsserver:8080/tfs/defaultcollection"&gt;http://mytfsserver:8080/tfs/defaultcollection&lt;/a&gt;&lt;/p&gt; &lt;p&gt;Please ensure you've (re-)installed Visual Studio 2008 SP1. If you installed Team Foundation Client after applying SP1, reinstall SP1.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9946465" width="1" height="1"&gt;</description></item><item><title>Active Directory - Adding a user to a group from a non domain-joined computer throws PrincipalException</title><link>http://blogs.msdn.com/b/martijnh/archive/2010/01/06/active-directory-adding-a-user-to-a-group-from-a-non-domain-joined-computer-throws-principalexception.aspx</link><pubDate>Wed, 06 Jan 2010 11:30:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9944488</guid><dc:creator>martijnh1</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/martijnh/rsscomments.aspx?WeblogPostID=9944488</wfw:commentRss><comments>http://blogs.msdn.com/b/martijnh/archive/2010/01/06/active-directory-adding-a-user-to-a-group-from-a-non-domain-joined-computer-throws-principalexception.aspx#comments</comments><description>&lt;p&gt;When using the new System.DirectoryServices.AccountManagement namespace, one might be inclined (as was I) to use the following code to add a user to a group (exception and comments handling removed):&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;GroupPrincipal &lt;/span&gt;groupPrincipal = 
    &lt;span style="color: #2b91af"&gt;GroupPrincipal&lt;/span&gt;.FindByIdentity(
        domainContext, 
        System.DirectoryServices.AccountManagement.&lt;span style="color: #2b91af"&gt;IdentityType&lt;/span&gt;.Name, 
        groupName))
{
    &lt;span style="color: blue"&gt;if &lt;/span&gt;(groupPrincipal != &lt;span style="color: blue"&gt;null&lt;/span&gt;)
    {
        &lt;span style="color: blue"&gt;using &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;UserPrincipal &lt;/span&gt;userPrincipal = 
            &lt;span style="color: #2b91af"&gt;UserPrincipal&lt;/span&gt;.FindByIdentity(
                domainContext, 
                System.DirectoryServices.AccountManagement.&lt;span style="color: #2b91af"&gt;IdentityType&lt;/span&gt;.UserPrincipalName, 
                UPN))
        {
            &lt;span style="color: blue"&gt;if &lt;/span&gt;(userPrincipal != &lt;span style="color: blue"&gt;null&lt;/span&gt;)
            {
                groupPrincipal.GroupScope = &lt;span style="color: #2b91af"&gt;GroupScope&lt;/span&gt;.Global;
                groupPrincipal.Members.Add(userPrincipal);
                groupPrincipal.Save();
            }
        }
    }
}
&lt;/pre&gt;
&lt;p&gt;This works just fine if your machine is joined to the domain you're trying to provision. However, if your machine is not joined, the groupPrincipal.Save(); call throws a PrincipalException with an error code 1355 ("Information about the domain could not be retrieved (1355)").&lt;/p&gt;
&lt;p&gt;Joining the domain solves this issue.&lt;/p&gt;
&lt;p&gt;So what if joining the domain isn't an option?&lt;/p&gt;
&lt;p&gt;In this case I found resorting to good old System.DirectoryServices fixes the issue, using the following code fragment:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;UserPrincipal &lt;/span&gt;userPrincipal =
    &lt;span style="color: #2b91af"&gt;UserPrincipal&lt;/span&gt;.FindByIdentity(domainContext, UPN))
{
    &lt;span style="color: blue"&gt;if &lt;/span&gt;(userPrincipal != &lt;span style="color: blue"&gt;null&lt;/span&gt;)
    {
        &lt;span style="color: blue"&gt;using &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;GroupPrincipal &lt;/span&gt;groupPrincipal =
            &lt;span style="color: #2b91af"&gt;GroupPrincipal&lt;/span&gt;.FindByIdentity(domainContext, groupName))
        {
            &lt;span style="color: blue"&gt;if &lt;/span&gt;(groupPrincipal != &lt;span style="color: blue"&gt;null&lt;/span&gt;)
            {
                &lt;span style="color: blue"&gt;if &lt;/span&gt;(!userPrincipal.IsMemberOf(groupPrincipal))
                {
                    &lt;span style="color: blue"&gt;string &lt;/span&gt;userSid = &lt;span style="color: blue"&gt;string&lt;/span&gt;.Format(&lt;span style="color: #a31515"&gt;"&amp;lt;SID={0}&amp;gt;"&lt;/span&gt;, userPrincipal.ToSidString());
                    &lt;span style="color: #2b91af"&gt;DirectoryEntry &lt;/span&gt;groupDirectoryEntry =
                        (&lt;span style="color: #2b91af"&gt;DirectoryEntry&lt;/span&gt;)groupPrincipal.GetUnderlyingObject();
                    groupDirectoryEntry.Properties[&lt;span style="color: #a31515"&gt;"member"&lt;/span&gt;].Add(userSid);
                    groupDirectoryEntry.CommitChanges();
                }
            }
        }
    }
}&lt;/pre&gt;
&lt;p&gt;ToSidString is an extension method which translates the "objectSid" property. Thanks to Richard for the way better implementation! (ignore "Enforce")&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;public static string &lt;/span&gt;ToSidString(&lt;span style="color: blue"&gt;this &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Principal &lt;/span&gt;principal)
{
    &lt;span style="color: #2b91af"&gt;Enforce&lt;/span&gt;.IsNotNull&amp;lt;&lt;span style="color: #2b91af"&gt;Principal&lt;/span&gt;&amp;gt;(principal, &lt;span style="color: #a31515"&gt;"principal"&lt;/span&gt;);

    &lt;span style="color: #2b91af"&gt;SecurityIdentifier &lt;/span&gt;sid = principal.Sid;
    &lt;span style="color: blue"&gt;if &lt;/span&gt;(sid == &lt;span style="color: blue"&gt;null &lt;/span&gt;|| sid.BinaryLength == 0)
    {
        &lt;span style="color: blue"&gt;return null&lt;/span&gt;;
    }

    &lt;span style="color: blue"&gt;byte&lt;/span&gt;[] buffer = &lt;span style="color: blue"&gt;new byte&lt;/span&gt;[sid.BinaryLength];
    sid.GetBinaryForm(buffer, 0);

    &lt;span style="color: blue"&gt;string&lt;/span&gt;[] hexBytes = &lt;span style="color: #2b91af"&gt;Array&lt;/span&gt;.ConvertAll(buffer, b =&amp;gt; b.ToString(&lt;span style="color: #a31515"&gt;"X2"&lt;/span&gt;, &lt;span style="color: #2b91af"&gt;NumberFormatInfo&lt;/span&gt;.InvariantInfo));

    &lt;span style="color: blue"&gt;return string&lt;/span&gt;.Concat(hexBytes);
}
&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;HTH!&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9944488" width="1" height="1"&gt;</description></item><item><title>Unity v1.2 - using enum values from configuration; writing and configuring a custom type converter</title><link>http://blogs.msdn.com/b/martijnh/archive/2010/01/06/unity-v1-2-using-enum-values-from-configuration-writing-and-configuring-a-custom-type-converter.aspx</link><pubDate>Wed, 06 Jan 2010 08:34:24 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9944431</guid><dc:creator>martijnh1</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/martijnh/rsscomments.aspx?WeblogPostID=9944431</wfw:commentRss><comments>http://blogs.msdn.com/b/martijnh/archive/2010/01/06/unity-v1-2-using-enum-values-from-configuration-writing-and-configuring-a-custom-type-converter.aspx#comments</comments><description>&lt;p&gt;Recently, I used Unity v1.2, which in my opinion is a great product. I had difficulty, however, with the configuration for a scenario I encountered. I needed an enum value to be passed to a constructor. Trying as I might, there was no way Unity was accepting my typeAlias, as such:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;unity&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;typeAliases&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;typeAlias 
      &lt;/span&gt;&lt;span style="color: red"&gt;alias&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;contextType&lt;/span&gt;" 
      &lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;System.DirectoryServices.AccountManagement.ContextType, 
            System.DirectoryServices.AccountManagement, Version=3.5.0.0, 
            Culture=neutral, PublicKeyToken=b77a5c561934e089&lt;/span&gt;" &lt;span style="color: blue"&gt;/&amp;gt;
  &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;typeAliases&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;containers&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;container &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;identitystores&lt;/span&gt;"&lt;span style="color: blue"&gt;&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;types&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;type &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;primary&lt;/span&gt;" &lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;IIdentityStore&lt;/span&gt;" &lt;span style="color: red"&gt;mapTo&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;ActiveDirectoryIdentityStore&lt;/span&gt;" &lt;span style="color: blue"&gt;&amp;gt;
          &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;lifetime &lt;/span&gt;&lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;singleton&lt;/span&gt;" &lt;span style="color: blue"&gt;/&amp;gt;
          &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;typeConfig 
            &lt;/span&gt;&lt;span style="color: red"&gt;extensionType&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;Microsoft.Practices.Unity.Configuration.TypeInjectionElement, 
                           Microsoft.Practices.Unity.Configuration&lt;/span&gt;"&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;constructor&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
              &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;param &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;context&lt;/span&gt;" &lt;span style="color: red"&gt;parameterType&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;contextType&lt;/span&gt;"&lt;span style="color: blue"&gt;&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;value
                  &lt;/span&gt;&lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;Domain&lt;/span&gt;"
                  &lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;contextType&lt;/span&gt;"  &lt;span style="color: blue"&gt;/&amp;gt;
              &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;param&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;constructor&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
          &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;typeConfig&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
      &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;types&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;container&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
  &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;containers&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;unity&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;For the life of me, I couldn't figure out what I did wrong. I asked in an internal discussion list, and someone mentioned writing a plain old TypeConverter... Right he was, getting my enum value to work was pretty easy. The TypeConverter (as always, comments removed for clarity and provided AS IS, etc.):&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ContextTypeTypeConverter &lt;/span&gt;: &lt;span style="color: #2b91af"&gt;TypeConverter
&lt;/span&gt;{
    &lt;span style="color: blue"&gt;public override bool &lt;/span&gt;CanConvertFrom(&lt;span style="color: #2b91af"&gt;ITypeDescriptorContext &lt;/span&gt;context, &lt;span style="color: #2b91af"&gt;Type &lt;/span&gt;sourceType)
    {
        &lt;span style="color: blue"&gt;return &lt;/span&gt;sourceType.GetType() == &lt;span style="color: blue"&gt;typeof&lt;/span&gt;(&lt;span style="color: blue"&gt;string&lt;/span&gt;);
    }

    &lt;span style="color: blue"&gt;public override bool &lt;/span&gt;CanConvertTo(&lt;span style="color: #2b91af"&gt;ITypeDescriptorContext &lt;/span&gt;context, &lt;span style="color: #2b91af"&gt;Type &lt;/span&gt;destinationType)
    {
        &lt;span style="color: blue"&gt;return &lt;/span&gt;destinationType == &lt;span style="color: blue"&gt;typeof&lt;/span&gt;(&lt;span style="color: #2b91af"&gt;ContextType&lt;/span&gt;);
    }
    
    &lt;span style="color: blue"&gt;public override object &lt;/span&gt;ConvertFrom(
        &lt;span style="color: #2b91af"&gt;ITypeDescriptorContext &lt;/span&gt;context, 
        &lt;span style="color: #2b91af"&gt;CultureInfo &lt;/span&gt;culture, 
        &lt;span style="color: blue"&gt;object &lt;/span&gt;value)
    {
        &lt;span style="color: blue"&gt;return &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Enum&lt;/span&gt;.Parse(&lt;span style="color: blue"&gt;typeof&lt;/span&gt;(&lt;span style="color: #2b91af"&gt;ContextType&lt;/span&gt;), (&lt;span style="color: blue"&gt;string&lt;/span&gt;)value);
    }

    &lt;span style="color: blue"&gt;public override object &lt;/span&gt;ConvertTo(
        &lt;span style="color: #2b91af"&gt;ITypeDescriptorContext &lt;/span&gt;context, 
        &lt;span style="color: #2b91af"&gt;CultureInfo &lt;/span&gt;culture, 
        &lt;span style="color: blue"&gt;object &lt;/span&gt;value, 
        &lt;span style="color: #2b91af"&gt;Type &lt;/span&gt;destinationType)
    {
        &lt;span style="color: blue"&gt;return &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Enum&lt;/span&gt;.GetName(&lt;span style="color: blue"&gt;typeof&lt;/span&gt;(&lt;span style="color: #2b91af"&gt;ContextType&lt;/span&gt;), value);
    }
}&lt;/pre&gt;
&lt;p&gt;and modified configuration file:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;unity&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;typeAliases&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;typeAlias &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: red"&gt;alias&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;contextType&lt;/span&gt;" &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;System.DirectoryServices.AccountManagement.ContextType, &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.DirectoryServices.AccountManagement, Version=3.5.0.0, &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Culture=neutral, PublicKeyToken=b77a5c561934e089&lt;/span&gt;" &lt;span style="color: blue"&gt;/&amp;gt;&lt;br&gt;&amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;typeAliases&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;containers&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;container&lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;identitystores&lt;/span&gt;"&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;types&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;type&lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;primary&lt;/span&gt;" &lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;IIdentityStore&lt;/span&gt;" &lt;span style="color: red"&gt;mapTo&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;ActiveDirectoryIdentityStore&lt;/span&gt;" &lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;lifetime&lt;/span&gt;&lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;singleton&lt;/span&gt;" &lt;span style="color: blue"&gt;/&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;typeConfig &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: red"&gt;extensionType&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;Microsoft.Practices.Unity.Configuration.TypeInjectionElement, &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Microsoft.Practices.Unity.Configuration&lt;/span&gt;"&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;constructor&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;param &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;context&lt;/span&gt;" &lt;span style="color: red"&gt;parameterType&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;string&lt;/span&gt;"&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;value&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;Domain&lt;/span&gt;"&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;contextType&lt;/span&gt;"&lt;br&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: red"&gt;typeConverter&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;/strong&gt;&lt;strong&gt;&lt;span style="color: blue"&gt;Microsoft.AccountManagement.Extensions.ContextTypeTypeConverter, &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Microsoft.AccountManagement.Extensions, Version=1.0.0.0, &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Culture=neutral, PublicKeyToken=4fd564a94067c21&lt;/span&gt;"&lt;/strong&gt;&lt;span style="color: blue"&gt;&lt;strong&gt;/&amp;gt;&lt;/strong&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;param&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;constructor&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;typeConfig&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;types&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;container&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;&amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;containers&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;unity&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;That's it, now everything works just fine. HTH someone out there :)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9944431" width="1" height="1"&gt;</description></item><item><title>WCF extensions: The type 'x' registered for extension 'y' could not be loaded.</title><link>http://blogs.msdn.com/b/martijnh/archive/2010/01/04/wcf-extensions-the-type-x-registered-for-extension-y-could-not-be-loaded.aspx</link><pubDate>Mon, 04 Jan 2010 12:26:14 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9943325</guid><dc:creator>martijnh1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/martijnh/rsscomments.aspx?WeblogPostID=9943325</wfw:commentRss><comments>http://blogs.msdn.com/b/martijnh/archive/2010/01/04/wcf-extensions-the-type-x-registered-for-extension-y-could-not-be-loaded.aspx#comments</comments><description>&lt;p&gt;Quick note: if you configure a custom extension in WCF, don't forget to add it as a reference to your project. If you don't configuration will run just fine, but at runtime, the following exception occurs:&lt;/p&gt; &lt;p&gt;System.Configuration.ConfigurationErrorsException: The type 'x' registered for extension 'y' could not be loaded. (config information, line z)&lt;/p&gt; &lt;p&gt;&amp;nbsp;&amp;nbsp; at System.Configuration.BaseConfigurationRecord.EvaluateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult)&lt;br&gt;&amp;nbsp;&amp;nbsp; at System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object&amp;amp; result, Object&amp;amp; resultRuntimeObject)&lt;br&gt;&amp;nbsp;&amp;nbsp; at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object&amp;amp; result, Object&amp;amp; resultRuntimeObject)&lt;br&gt;&amp;nbsp;&amp;nbsp; at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object&amp;amp; result, Object&amp;amp; resultRuntimeObject)&lt;br&gt;&amp;nbsp;&amp;nbsp; at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object&amp;amp; result, Object&amp;amp; resultRuntimeObject)&lt;br&gt;&amp;nbsp;&amp;nbsp; at System.Configuration.BaseConfigurationRecord.GetSection(String configKey)&lt;br&gt;&amp;nbsp;&amp;nbsp; at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName)&lt;br&gt;&amp;nbsp;&amp;nbsp; at System.Configuration.ConfigurationManager.GetSection(String sectionName)&lt;br&gt;&amp;nbsp;&amp;nbsp; at System.ServiceModel.Configuration.ConfigurationHelpers.UnsafeGetSectionFromConfigurationManager(String sectionPath)&lt;br&gt;&amp;nbsp;&amp;nbsp; at System.ServiceModel.Configuration.ConfigurationHelpers.UnsafeGetAssociatedSection(ContextInformation evalContext, String sectionPath)&lt;br&gt;&amp;nbsp;&amp;nbsp; at System.ServiceModel.Configuration.ServicesSection.UnsafeGetSection()&lt;br&gt;&amp;nbsp;&amp;nbsp; at System.ServiceModel.Description.ConfigLoader.LookupService(String serviceConfigurationName)&lt;br&gt;&amp;nbsp;&amp;nbsp; at System.ServiceModel.ServiceHostBase.ApplyConfiguration()&lt;br&gt;&amp;nbsp;&amp;nbsp; at System.ServiceModel.ServiceHostBase.InitializeDescription(UriSchemeKeyedCollection baseAddresses)&lt;br&gt;&amp;nbsp;&amp;nbsp; at System.ServiceModel.ServiceHost..ctor(Type serviceType, Uri[] baseAddresses)&lt;br&gt;&amp;nbsp;&amp;nbsp; at Microsoft.Tools.SvcHost.ServiceHostHelper.CreateServiceHost(Type type, ServiceKind kind)&lt;br&gt;&amp;nbsp;&amp;nbsp; at Microsoft.Tools.SvcHost.ServiceHostHelper.OpenService(ServiceInfo info) &lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9943325" width="1" height="1"&gt;</description></item><item><title>Unit testing: COM object that has been separated from its underlying RCW cannot be used</title><link>http://blogs.msdn.com/b/martijnh/archive/2009/12/31/unit-testing-com-object-that-has-been-separated-from-its-underlying-rcw-cannot-be-used.aspx</link><pubDate>Thu, 31 Dec 2009 10:20:39 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9942540</guid><dc:creator>martijnh1</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/martijnh/rsscomments.aspx?WeblogPostID=9942540</wfw:commentRss><comments>http://blogs.msdn.com/b/martijnh/archive/2009/12/31/unit-testing-com-object-that-has-been-separated-from-its-underlying-rcw-cannot-be-used.aspx#comments</comments><description>&lt;p&gt;Let's say you're writing unit tests for code which uses COM objects. You want some initialization and some cleanup to be done. So you set up your test:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;private static &lt;/span&gt;&lt;span style="color: #2b91af"&gt;MyStore &lt;/span&gt;store;
&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;pre class="code"&gt;[&lt;span style="color: #2b91af"&gt;ClassInitialize&lt;/span&gt;()]
&lt;span style="color: blue"&gt;public static void &lt;/span&gt;MyClassInitialize(&lt;span style="color: #2b91af"&gt;TestContext &lt;/span&gt;testContext)
{
    store = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;MyStore&lt;/span&gt;(&lt;span style="color: #a31515"&gt;"some value"&lt;/span&gt;);
}
&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;pre class="code"&gt;[&lt;span style="color: #2b91af"&gt;ClassCleanup&lt;/span&gt;]
&lt;span style="color: blue"&gt;public static void &lt;/span&gt;MyClassCleanup()
{
&lt;span style="color: green"&gt;    &lt;/span&gt;store.DoWork(someArgument);
}&lt;/pre&gt;
&lt;p&gt;However, as your 'store' instance uses a COM object, you will get a test run error, saying: "System.Runtime.InteropServices.InvalidComObjectException: COM object that has been separated from its underlying RCW cannot be used..".&lt;/p&gt;
&lt;p&gt;The way to solve this issue is to open up your testrunconfig file using the XML editor and adding the highlighted element to it:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;?&lt;/span&gt;&lt;span style="color: #a31515"&gt;xml &lt;/span&gt;&lt;span style="color: red"&gt;version&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;1.0&lt;/span&gt;" &lt;span style="color: red"&gt;encoding&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;UTF-8&lt;/span&gt;"&lt;span style="color: blue"&gt;?&amp;gt;
&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TestRunConfiguration &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;Local Test Run&lt;/span&gt;" &lt;span style="color: red"&gt;id&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;fbbfe81f-97fa-4e33-bde1-00b3827b933e&lt;/span&gt;" &lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;http://microsoft.com/schemas/VisualStudio/TeamTest/2006&lt;/span&gt;"&lt;span style="color: blue"&gt;&amp;gt;
&lt;strong&gt;  &amp;lt;&lt;/strong&gt;&lt;/span&gt;&lt;strong&gt;&lt;span style="color: #a31515"&gt;ExecutionThread &lt;/span&gt;&lt;span style="color: red"&gt;apartmentState&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;MTA&lt;/span&gt;" &lt;/strong&gt;&lt;span style="color: blue"&gt;&lt;strong&gt;/&amp;gt;
&lt;/strong&gt;  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Description&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;This is a default test run configuration for a local test run.&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Description&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TestTypeSpecific &lt;/span&gt;&lt;span style="color: blue"&gt;/&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;TestRunConfiguration&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;The ExecutionThread element will instruct the test to use the MTA threading model. This way, the static instance of "store" can be shared across tests.&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9942540" width="1" height="1"&gt;</description></item><item><title>Office 2010 Development – Outlook main window ribbon ID</title><link>http://blogs.msdn.com/b/martijnh/archive/2009/09/01/office-2010-development-outlook-main-window-ribbon-id.aspx</link><pubDate>Tue, 01 Sep 2009 09:51:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9889771</guid><dc:creator>martijnh1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/martijnh/rsscomments.aspx?WeblogPostID=9889771</wfw:commentRss><comments>http://blogs.msdn.com/b/martijnh/archive/2009/09/01/office-2010-development-outlook-main-window-ribbon-id.aspx#comments</comments><description>&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="mso-ansi-language: en" lang=EN&gt;&lt;FONT color=#000000 size=3 face=Calibri&gt;I’m currently writing an Outlook add-in and I’m looking into getting this compatible with both Office 2007 and Office 2010. One of the new features in Outlook 2010 is the main window Ribbon. &lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="mso-ansi-language: en" lang=EN&gt;&lt;FONT color=#000000 size=3 face=Calibri&gt;Using VSTO, you can create your own Ribbon, which can be automatically merged with default Ribbons by setting the correct OfficeId property for your Ribbon. Office 2007 has the list of available OfficeId values available &lt;/FONT&gt;&lt;A href="http://blogs.msdn.com/redir.aspx?C=f3c986b3badc4ac3bb1025b97e021ab9&amp;amp;URL=http%3a%2f%2fwww.microsoft.com%2fdownloads%2fdetails.aspx%3ffamilyid%3d4329D9E9-4D11-46A5-898D-23E4F331E9AE%26displaylang%3den" mce_href="http://blogs.msdn.com/redir.aspx?C=f3c986b3badc4ac3bb1025b97e021ab9&amp;amp;URL=http%3a%2f%2fwww.microsoft.com%2fdownloads%2fdetails.aspx%3ffamilyid%3d4329D9E9-4D11-46A5-898D-23E4F331E9AE%26displaylang%3den"&gt;&lt;FONT color=#0000ff size=3 face=Calibri&gt;here&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3&gt;&lt;FONT color=#000000&gt;&lt;FONT face=Calibri&gt;, but I has some trouble locating a list for the Office 2010 Technical Preview. &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="mso-ansi-language: en" lang=EN&gt;&lt;FONT size=3&gt;&lt;FONT color=#000000&gt;&lt;FONT face=Calibri&gt;After some trial and error, I figures out there’s an easy way to find out what the different IDs for a specific Ribbon and it’s tabs is. 
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="mso-ansi-language: en" lang=EN&gt;&lt;FONT size=3&gt;&lt;FONT color=#000000&gt;&lt;FONT face=Calibri&gt;Office 2010 let’s users customize the Ribbon from within Office.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt; 
&lt;P&gt;&lt;FONT color=#000000 size=3 face=Calibri&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/Office2010DevelopmentOutlookmainwindowri_A679/outlook_2010_ribbon_001_2.png" mce_href="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/Office2010DevelopmentOutlookmainwindowri_A679/outlook_2010_ribbon_001_2.png"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=outlook_2010_ribbon_001 border=0 alt=outlook_2010_ribbon_001 src="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/Office2010DevelopmentOutlookmainwindowri_A679/outlook_2010_ribbon_001_thumb.png" width=719 height=502 mce_src="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/Office2010DevelopmentOutlookmainwindowri_A679/outlook_2010_ribbon_001_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="mso-ansi-language: en" lang=EN&gt;&lt;FONT color=#000000 size=3 face=Calibri&gt;Clicking ‘Customize the Ribbon’ brings up the customization dialog:&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/Office2010DevelopmentOutlookmainwindowri_A679/outlook_2010_ribbon_002_2.png" mce_href="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/Office2010DevelopmentOutlookmainwindowri_A679/outlook_2010_ribbon_002_2.png"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=outlook_2010_ribbon_002 border=0 alt=outlook_2010_ribbon_002 src="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/Office2010DevelopmentOutlookmainwindowri_A679/outlook_2010_ribbon_002_thumb.png" width=732 height=599 mce_src="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/Office2010DevelopmentOutlookmainwindowri_A679/outlook_2010_ribbon_002_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="mso-ansi-language: en" lang=EN&gt;&lt;FONT size=3&gt;&lt;FONT color=#000000&gt;&lt;FONT face=Calibri&gt;On the right-hand side of the dialog, right-click the ‘RSS’ tab within the expanded ‘Home’ tab and choose ‘Rename’. Name it e.g. ‘testRSS’. After customizing, press OK on the dialog and re-open the customization dialog once more (if you don’t close and re-open the dialog, the following steps will not lead to the desired result).&amp;nbsp; 
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="mso-ansi-language: en" lang=EN&gt;&lt;FONT size=3&gt;&lt;FONT color=#000000&gt;&lt;FONT face=Calibri&gt;Now press the ‘Import/Export’ button and select ‘Export all Ribbon and Quick Access Toolbar customizations’. Save the file.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt; 
&lt;P&gt;&lt;FONT color=#000000 size=3 face=Calibri&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/Office2010DevelopmentOutlookmainwindowri_A679/outlook_2010_ribbon_003_2.png" mce_href="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/Office2010DevelopmentOutlookmainwindowri_A679/outlook_2010_ribbon_003_2.png"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=outlook_2010_ribbon_003 border=0 alt=outlook_2010_ribbon_003 src="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/Office2010DevelopmentOutlookmainwindowri_A679/outlook_2010_ribbon_003_thumb.png" width=732 height=541 mce_src="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/Office2010DevelopmentOutlookmainwindowri_A679/outlook_2010_ribbon_003_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="mso-ansi-language: en" lang=EN&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;The exported Office UI file has a .exportedUI extension. Rename this to .xml and open up the file. You’ll see something like this:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="mso-ansi-language: en" lang=EN&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"&gt;&lt;/SPAN&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt"&gt;mso:cmd&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"&gt; &lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt"&gt;app&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"&gt;=&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt"&gt;"&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"&gt;MSOutlook&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt"&gt;"&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"&gt; &lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt"&gt;dt&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"&gt;=&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt"&gt;"&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"&gt;0&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt"&gt;"&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"&gt; /&amp;gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt"&gt;mso:customUI&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"&gt; &lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt"&gt;xmlns:mso&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"&gt;=&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt"&gt;"&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"&gt;http://schemas.microsoft.com/office/2007/10/customui&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt"&gt;"&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;nbsp; &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt"&gt;mso:ribbon&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt"&gt;mso:qat&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"&gt;/&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt"&gt;mso:tabs&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt"&gt;mso:tab&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"&gt; &lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt"&gt;idQ&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"&gt;=&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt"&gt;"&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"&gt;mso:&lt;STRONG&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;TabMail&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt"&gt;"&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt"&gt;mso:group&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"&gt; &lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt"&gt;idQ&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"&gt;=&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt"&gt;"&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"&gt;mso:GroupRss&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt"&gt;"&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"&gt; &lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt"&gt;label&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"&gt;=&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt"&gt;"&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"&gt;testRSS&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt"&gt;"&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"&gt;/&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt"&gt;mso:tab&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt"&gt;mso:tabs&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;nbsp; &amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt"&gt;mso:ribbon&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt"&gt;mso:customUI&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&lt;SPAN style="mso-ansi-language: en" lang=EN&gt;&lt;FONT face="Times New Roman"&gt;&lt;FONT color=#000000&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="mso-ansi-language: en" lang=EN&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Note the ‘TabMail’ ID. This is the current (it’s a technical preview, things will probably change in the future) identifier for the Ribbon Tab you’ve just modified.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-ansi-language: en" lang=EN&gt;&lt;FONT size=3&gt;OK, we’ve got the Tab OfficeID. However, for a Ribbon to show up, you also need to specify RibbonType property. Normally, using VSTO, you get a drop down with all possible values for this property within Visual Studio. However, the main window Ribbon in Outlook is new, so there’s no value for this Ribbon within the list. Luckily, you can also type in your own value. Now all that’s left is finding out the name of the main Ribbon and we’d be set.&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Calibri&gt;
&lt;P&gt;&lt;FONT size=3&gt;I looked around, but the value for the main Ribbon was a mystery to me. Finally, I decided Outlook probably had the string in memory during runtime, so I could use Process Explorer to find the correct value. As you probably know, Process Explorer has a tab called ‘strings’ on the properties dialog of a process. This tab enumerates all strings within the image of the process and lists them here. &lt;/FONT&gt;&lt;/P&gt;&lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=Calibri&gt;
&lt;P&gt;&lt;FONT size=3&gt;&lt;A href="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/Office2010DevelopmentOutlookmainwindowri_A679/outlook_2010_ribbon_004_2.png" mce_href="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/Office2010DevelopmentOutlookmainwindowri_A679/outlook_2010_ribbon_004_2.png"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=outlook_2010_ribbon_004 border=0 alt=outlook_2010_ribbon_004 src="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/Office2010DevelopmentOutlookmainwindowri_A679/outlook_2010_ribbon_004_thumb.png" width=530 height=614 mce_src="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/Office2010DevelopmentOutlookmainwindowri_A679/outlook_2010_ribbon_004_thumb.png"&gt;&lt;/A&gt; &lt;/FONT&gt;&lt;/P&gt;&lt;/FONT&gt;
&lt;P&gt;&lt;FONT face=Calibri&gt;
&lt;P&gt;&lt;FONT size=3&gt;I searched for ‘Microsoft.Outlook.’ (all values in the regular drop down start with this) and found ‘Microsoft.Outlook.Explorer’. Searching further, the other values we all know and love came up. However, ‘Microsoft.Outlook.Explorer’ was the only truly new value.&lt;/FONT&gt;&lt;/P&gt;&lt;/FONT&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;A href="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/Office2010DevelopmentOutlookmainwindowri_A679/outlook_2010_ribbon_005_2.png" mce_href="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/Office2010DevelopmentOutlookmainwindowri_A679/outlook_2010_ribbon_005_2.png"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=outlook_2010_ribbon_005 border=0 alt=outlook_2010_ribbon_005 src="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/Office2010DevelopmentOutlookmainwindowri_A679/outlook_2010_ribbon_005_thumb.png" width=531 height=614 mce_src="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/Office2010DevelopmentOutlookmainwindowri_A679/outlook_2010_ribbon_005_thumb.png"&gt;&lt;/A&gt;&lt;A href="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/Office2010DevelopmentOutlookmainwindowri_A679/outlook_2010_ribbon_006_2.png" mce_href="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/Office2010DevelopmentOutlookmainwindowri_A679/outlook_2010_ribbon_006_2.png"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=outlook_2010_ribbon_006 border=0 alt=outlook_2010_ribbon_006 src="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/Office2010DevelopmentOutlookmainwindowri_A679/outlook_2010_ribbon_006_thumb.png" width=531 height=615 mce_src="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/Office2010DevelopmentOutlookmainwindowri_A679/outlook_2010_ribbon_006_thumb.png"&gt;&lt;/A&gt; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=3 face=Calibri&gt;I tried using this value for the RibbonType and low and behold, my add-in appeared on the ‘RSS’ tab of the main Ribbon.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=3 face=Calibri&gt;&lt;FONT color=#ff0000&gt;&lt;STRONG&gt;Key take-away&lt;/STRONG&gt;&lt;/FONT&gt;: Using a RibbonType of ‘Microsoft.Outlook.Explorer’ and ‘TabMail’ as your ControlId, you can place your add-in on the main ribbon of the Outlook window.&lt;/FONT&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/FONT&gt;
&lt;P mce_keep="true"&gt;UPDATE: in Visual Studio 2010 beta 2, you can just select the RibbonType mentioned ;-)&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Disclaimer: This has been tested on the Technical Preview of Office 2010. There are no guarantees whether these IDs will be stable as we move forward with the product.&lt;/STRONG&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9889771" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/martijnh/archive/tags/Outlook+2007/">Outlook 2007</category><category domain="http://blogs.msdn.com/b/martijnh/archive/tags/-NET/">.NET</category><category domain="http://blogs.msdn.com/b/martijnh/archive/tags/Outlook+2010/">Outlook 2010</category><category domain="http://blogs.msdn.com/b/martijnh/archive/tags/Technical+Preview/">Technical Preview</category><category domain="http://blogs.msdn.com/b/martijnh/archive/tags/Office+2010/">Office 2010</category><category domain="http://blogs.msdn.com/b/martijnh/archive/tags/Ribbon/">Ribbon</category></item><item><title>PrintMonitor – A C# print spooler monitor</title><link>http://blogs.msdn.com/b/martijnh/archive/2009/08/05/printmonitor-a-c-print-spooler-monitor.aspx</link><pubDate>Wed, 05 Aug 2009 12:40:34 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9857901</guid><dc:creator>martijnh1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/martijnh/rsscomments.aspx?WeblogPostID=9857901</wfw:commentRss><comments>http://blogs.msdn.com/b/martijnh/archive/2009/08/05/printmonitor-a-c-print-spooler-monitor.aspx#comments</comments><description>&lt;p&gt;Recently, a colleague of mine had a requirement of getting information on the number of pages being printed by users. Monitoring a printer is done by calling FindFirstPrinterChangeNotification, waiting for the returned WaitHandle to be signaled and then calling &lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;FindNextPrinterChangeNotification to see why the handle got signaled and act accordingly. Sadly, there don’t seem to be any samples of this in C# out there, so I created one in my spare time. The attached application monitors all printer notification fields possible. It still has some issues like not disposing things correctly, but that’s left as an exercise to the reader, as I don’t have more time to spent.&lt;/font&gt;&lt;/p&gt; &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: left; padding-top: 0px" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:826d266e-5b4d-400e-a77b-4fc6cf0b51ed" class="wlWriterEditableSmartContent"&gt;&lt;a href="http://home.online.nl/martijnhoogendoorn/blogpictures/PrintMonitorACprintspoolermonitor_A429/printmonitor8x6b165b1fd7c3f405193c1aeaa24ff0e50.png" title="Yes, I printed 1624 pages (to XPS)" rel="thumbnail"&gt;&lt;img border="0" src="http://home.online.nl/martijnhoogendoorn/blogpictures/PrintMonitorACprintspoolermonitor_A429/printmonitor2c61f610edbd43ca8c349d77cbaa097a.png" width="361" height="273" /&gt;&lt;/a&gt;&lt;/div&gt; &lt;p&gt;&lt;font size="2"&gt;Upon starting the application, the Load event of the main form hooks up the event and handles (it currently takes the first printer it can find):&lt;/font&gt;&lt;/p&gt;&lt;pre class="code"&gt;&lt;font size="2"&gt;printerWaitHandle = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ManualResetEvent&lt;/span&gt;(&lt;span style="color: blue"&gt;false&lt;/span&gt;);

&lt;span style="color: #2b91af"&gt;PRINTER_INFO_2&lt;/span&gt;[] printers = enumPrinters(&lt;span style="color: #2b91af"&gt;PrinterEnumFlags&lt;/span&gt;.PRINTER_ENUM_NAME);
&lt;span style="color: blue"&gt;string &lt;/span&gt;printerName = printers[0].pPrinterName;
OpenPrinter(printerName, &lt;span style="color: blue"&gt;out &lt;/span&gt;printerHandle, 0);

printerChangeHandle = FindFirstPrinterChangeNotification(printerHandle, (&lt;span style="color: blue"&gt;int&lt;/span&gt;)&lt;span style="color: #2b91af"&gt;PRINTER_CHANGES&lt;/span&gt;.PRINTER_CHANGE_DELETE_JOB, 0, notifyOptions);
printerWaitHandle.SafeWaitHandle = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;SafeWaitHandle&lt;/span&gt;(printerChangeHandle, &lt;span style="color: blue"&gt;true&lt;/span&gt;);

printerChangeNotificationHandle = &lt;span style="color: #2b91af"&gt;ThreadPool&lt;/span&gt;.RegisterWaitForSingleObject(&lt;/font&gt;&lt;/pre&gt;
&lt;blockquote&gt;&lt;pre class="code"&gt;&lt;font size="2"&gt;printerWaitHandle, &lt;/font&gt;&lt;/pre&gt;&lt;pre class="code"&gt;&lt;font size="2"&gt;&lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;WaitOrTimerCallback&lt;/span&gt;(PrinterNotifyWaitCallback), printerWaitHandle, -1, &lt;span style="color: blue"&gt;true&lt;/span&gt;);
&lt;/font&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;&lt;font size="2"&gt;The callback method (PrinterNotifyWaitCallback) interprets the change:&lt;/font&gt;&lt;/p&gt;&lt;pre class="code"&gt;&lt;font size="2"&gt;&lt;span style="color: blue"&gt;public void &lt;/span&gt;PrinterNotifyWaitCallback(&lt;span style="color: blue"&gt;object &lt;/span&gt;state, &lt;span style="color: blue"&gt;bool &lt;/span&gt;timedOut)
{
    &lt;/font&gt;&lt;font size="2"&gt;&lt;span style="color: green"&gt;// BUG: if we Thread.Sleep here for the amount of time it takes to spool the print job, we only get the right notification for number of pages.

    &lt;/span&gt;&lt;span style="color: blue"&gt;int &lt;/span&gt;changeReason = 0;
    &lt;span style="color: #2b91af"&gt;IntPtr &lt;/span&gt;pNotifyInfo = &lt;span style="color: #2b91af"&gt;IntPtr&lt;/span&gt;.Zero;

    &lt;span style="color: blue"&gt;bool &lt;/span&gt;nxt = FindNextPrinterChangeNotification(printerChangeHandle, &lt;span style="color: blue"&gt;out &lt;/span&gt;changeReason, &lt;span style="color: blue"&gt;null&lt;/span&gt;, &lt;span style="color: blue"&gt;out &lt;/span&gt;pNotifyInfo);
&lt;/font&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/pre&gt;&lt;pre class="code"&gt;&lt;font size="2"&gt;...&lt;/font&gt;&lt;/pre&gt;&lt;pre class="code"&gt;&lt;font size="2"&gt;}
&lt;/font&gt;&lt;/pre&gt;
&lt;p&gt;This works quite well. There is a bug in there somewhere which causes the following behavior: the total number of pages is first set to 0 when spooling the print job and only on the *subsequent* print job being printed is the correct number of pages signaled. If you put a Thread.Sleep (don’t ;-)) in the callback for the amount of time it takes the spooler to spool the print job, the correct number of printed pages is displayed directly (without the ‘0’ entry and within the actual print job it belongs to). If anyone can find the bug, please let me know!&lt;/p&gt;
&lt;p&gt;Sourcecode attached, as always, no warranties of any kind, express, implied, etc.&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:fb3a1972-4489-4e52-abe7-25a00bb07fdf:14be0dbc-db38-4a94-94dd-4271c78de1f0" class="wlWriterEditableSmartContent"&gt;&lt;p&gt; &lt;a href="http://home.online.nl/martijnhoogendoorn/blogpictures/PrintMonitorACprintspoolermonitor_A429/PrintMonitor9bca0cc1cf21425f9b1c8378bb456aeb.zip"&gt;Sourcecode&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9857901" width="1" height="1"&gt;</description></item><item><title>Outlook Add-in: Replying to people who voted</title><link>http://blogs.msdn.com/b/martijnh/archive/2009/08/04/outlook-add-in-replying-to-people-who-voted.aspx</link><pubDate>Tue, 04 Aug 2009 22:19:21 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9857360</guid><dc:creator>martijnh1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/martijnh/rsscomments.aspx?WeblogPostID=9857360</wfw:commentRss><comments>http://blogs.msdn.com/b/martijnh/archive/2009/08/04/outlook-add-in-replying-to-people-who-voted.aspx#comments</comments><description>&lt;p&gt;Recently, I asked my colleagues if they were interested in beta testing some software I’m building for internal use. I used voting buttons to enable easy tracking of replies. When I wanted to reply to all people who voted “Yes” on my request, I discovered there’s no real way of just replying to a set of people who voted a certain way. Meet “ReplyToVoteTrackingType” (what’s in a name?); it’s an add-in which allows you to easily reply to anyone who casted a certain vote by selecting that vote:&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:95500e22-a9e4-4547-b838-efdbf9d15013" class="wlWriterEditableSmartContent"&gt;&lt;a href="http://home.online.nl/martijnhoogendoorn/blogpictures/OutlookAddinReplyingtopeoplewhovoted_1290F/ReplyToVoteTrackingType8x62aaa2a8a9e684839a8adb08035bd4c98.png" title="Example reply to vote audience" rel="thumbnail"&gt;&lt;img border="0" src="http://home.online.nl/martijnhoogendoorn/blogpictures/OutlookAddinReplyingtopeoplewhovoted_1290F/ReplyToVoteTrackingType40f8c52b5baf433d9d7836556faa38ce.png" width="577" height="653" /&gt;&lt;/a&gt;&lt;/div&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;The code for the add-in is pretty straight-forward, when loading the Ribbon we fill the dropdown menu with the items from the original vote and hookup the same event handler (we don’t discriminate) to each added button:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: green"&gt;// Retrieve the MailItem we're currently viewing.
&lt;/span&gt;currentItem = ((&lt;span style="color: #2b91af"&gt;InspectorClass&lt;/span&gt;)&lt;span style="color: blue"&gt;this&lt;/span&gt;.Context).CurrentItem &lt;span style="color: blue"&gt;as &lt;/span&gt;&lt;span style="color: #2b91af"&gt;MailItem&lt;/span&gt;;
&lt;span style="color: green"&gt;// Retrieve all possible voting options from when we sent out the e-mail.
&lt;/span&gt;&lt;span style="color: blue"&gt;string&lt;/span&gt;[] votingOptions = currentItem.VotingOptions.Split(&lt;span style="color: blue"&gt;new char&lt;/span&gt;[] { &lt;span style="color: #a31515"&gt;';' &lt;/span&gt;});

&lt;span style="color: green"&gt;// Set up a button for each of the options, labeled &amp;lt;option&amp;gt; ('yes', 'no', etc.).
&lt;/span&gt;&lt;span style="color: blue"&gt;foreach &lt;/span&gt;(&lt;span style="color: blue"&gt;string &lt;/span&gt;votingOption &lt;span style="color: blue"&gt;in &lt;/span&gt;votingOptions)
{
    &lt;span style="color: #2b91af"&gt;RibbonButton &lt;/span&gt;btn = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;RibbonButton&lt;/span&gt;() { Label = votingOption, SuperTip = &lt;span style="color: blue"&gt;string&lt;/span&gt;.Format(&lt;span style="color: #2b91af"&gt;Resources&lt;/span&gt;.SuperTip, votingOption) };
    btn.Click += clickEventHandler;
    mnuReplyToTracking.Items.Add(btn);
}
&lt;/pre&gt;
&lt;p&gt;Then, when the end user clicks on any of the voting options (e.g. “Yes” as the picture above shows), we check who responded in this fashion and add them to a newly created e-mail:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: #2b91af"&gt;StringBuilder &lt;/span&gt;recipients = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;StringBuilder&lt;/span&gt;();

&lt;span style="color: green"&gt;// For each recipient,
&lt;/span&gt;&lt;span style="color: blue"&gt;foreach &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;Recipient &lt;/span&gt;recipient &lt;span style="color: blue"&gt;in &lt;/span&gt;currentItem.Recipients)
{
    &lt;span style="color: green"&gt;// if they responded, and the response is what the users choose for a target audience,
    &lt;/span&gt;&lt;span style="color: blue"&gt;if &lt;/span&gt;(recipient.AutoResponse != &lt;span style="color: blue"&gt;null &lt;/span&gt;&amp;amp;&amp;amp; &lt;span style="color: blue"&gt;string&lt;/span&gt;.Compare(recipient.AutoResponse, ((&lt;span style="color: #2b91af"&gt;RibbonButton&lt;/span&gt;)sender).Label, &lt;span style="color: blue"&gt;true&lt;/span&gt;, &lt;span style="color: #2b91af"&gt;CultureInfo&lt;/span&gt;.InvariantCulture) == 0)
    {
        &lt;span style="color: green"&gt;// add the recipient to the addressee list.
        &lt;/span&gt;recipients.AppendFormat(&lt;span style="color: #a31515"&gt;"{0};"&lt;/span&gt;, recipient.Name);
    }
}

&lt;span style="color: green"&gt;// Set up a new e-mail to the addressees.
&lt;/span&gt;&lt;span style="color: #2b91af"&gt;MailItem &lt;/span&gt;mail = ((&lt;span style="color: #2b91af"&gt;InspectorClass&lt;/span&gt;)&lt;span style="color: blue"&gt;this&lt;/span&gt;.Context).Application.CreateItem(&lt;span style="color: #2b91af"&gt;OlItemType&lt;/span&gt;.olMailItem) &lt;span style="color: blue"&gt;as &lt;/span&gt;&lt;span style="color: #2b91af"&gt;MailItem&lt;/span&gt;;
mail.To = recipients.ToString();
&lt;span style="color: green"&gt;// Convenience: set the mail subject to be "RE: &amp;lt;subject of voting e-mail&amp;gt;".
&lt;/span&gt;mail.Subject = &lt;span style="color: blue"&gt;string&lt;/span&gt;.Format(&lt;span style="color: #2b91af"&gt;Resources&lt;/span&gt;.ReplyToVoteEmail, currentItem.Subject);
&lt;span style="color: green"&gt;// Display the e-mail, non-modal.
&lt;/span&gt;mail.Display(&lt;span style="color: blue"&gt;false&lt;/span&gt;);&lt;/pre&gt;
&lt;p&gt;That’s all; now, when the end users wants to reach his/her audience given a certain vote, it’s as easy as click the right voting reply!&lt;/p&gt;
&lt;p&gt;Source code is attached, as is an installer. As always, NO WARRANTIES.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:fb3a1972-4489-4e52-abe7-25a00bb07fdf:5278e2e2-21ff-4486-9c27-156d7be6636a" class="wlWriterEditableSmartContent"&gt;&lt;p&gt; &lt;a href="http://home.online.nl/martijnhoogendoorn/blogpictures/OutlookAddinReplyingtopeoplewhovoted_1290F/ReplyToVoteTrackingType_Source784afc5a10354c6c9752db63debaa211.zip"&gt;Source code&lt;/a&gt;&lt;br /&gt; &lt;a href="http://home.online.nl/martijnhoogendoorn/blogpictures/OutlookAddinReplyingtopeoplewhovoted_1290F/ReplyToVoteTrackingTypeInstallerfe3e34c69f3e44c0a0602ccc064c4d1f.zip"&gt;Installer&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9857360" width="1" height="1"&gt;</description></item><item><title>Feedback requested: Planning on Enterprise Library 5 has started!</title><link>http://blogs.msdn.com/b/martijnh/archive/2009/01/29/feedback-requested-planning-on-enterprise-library-5-has-started.aspx</link><pubDate>Thu, 29 Jan 2009 09:50:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9382634</guid><dc:creator>martijnh1</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/martijnh/rsscomments.aspx?WeblogPostID=9382634</wfw:commentRss><comments>http://blogs.msdn.com/b/martijnh/archive/2009/01/29/feedback-requested-planning-on-enterprise-library-5-has-started.aspx#comments</comments><description>&lt;P style="MARGIN: 0in 0in 0pt" class=MsoNormal&gt;Planning on Enterprise Library 5 has started! See Gregori's blog for more information if you want your EntLib needs to be in the next release: &lt;A href="http://blogs.msdn.com/agile/archive/2009/01/26/enterprise-library-5-what-s-on-your-wish-list.aspx"&gt;&lt;FONT size=3 face=Calibri&gt;http://blogs.msdn.com/agile/archive/2009/01/26/enterprise-library-5-what-s-on-your-wish-list.aspx&lt;/FONT&gt;&lt;/A&gt;!&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9382634" width="1" height="1"&gt;</description></item><item><title>Reflector add-in: Favorites</title><link>http://blogs.msdn.com/b/martijnh/archive/2009/01/15/reflector-add-in-favorites.aspx</link><pubDate>Thu, 15 Jan 2009 14:47:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9320647</guid><dc:creator>martijnh1</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/martijnh/rsscomments.aspx?WeblogPostID=9320647</wfw:commentRss><comments>http://blogs.msdn.com/b/martijnh/archive/2009/01/15/reflector-add-in-favorites.aspx#comments</comments><description>&lt;P&gt;Every developer knows about and uses Reflector ;-) I use it a lot to learn about the inner workings of products. When analyzing what goes where and why, it's easy to lose track (jumping from method to method to base class, etc.). Bookmarks are quick and easy, but don't allow for a description to be added. If I need to get back to a certain point within my analysis two weeks (ok, ok, two minutes ;-)) later, the Type declaration from the bookmarks doesn't help me.&lt;/P&gt;
&lt;P&gt;Meet Reflector Favorites!&lt;/P&gt;
&lt;P&gt;I wrote Reflector Favorites. It allows for developers to:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Easily tag a location within Reflector, adding a description that works for you. 
&lt;LI&gt;Import/Export favorites between computers. 
&lt;LI&gt;Share favorites (they work as long as you have the right assemblies opened in Reflector).&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/ReflectoraddinFavorites_B37A/reflector_001_2.png" mce_href="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/ReflectoraddinFavorites_B37A/reflector_001_2.png"&gt;&lt;IMG style="BORDER-RIGHT-WIDTH: 0px; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" border=0 alt=reflector_001 src="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/ReflectoraddinFavorites_B37A/reflector_001_thumb.png" width=192 height=244 mce_src="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/ReflectoraddinFavorites_B37A/reflector_001_thumb.png"&gt;&lt;/A&gt; &lt;A href="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/ReflectoraddinFavorites_B37A/reflector_002_2.png" mce_href="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/ReflectoraddinFavorites_B37A/reflector_002_2.png"&gt;&lt;IMG style="BORDER-RIGHT-WIDTH: 0px; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" border=0 alt=reflector_002 src="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/ReflectoraddinFavorites_B37A/reflector_002_thumb.png" width=192 height=244 mce_src="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/ReflectoraddinFavorites_B37A/reflector_002_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Reflector Favorites in action.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/ReflectoraddinFavorites_B37A/reflector_003_2.png" mce_href="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/ReflectoraddinFavorites_B37A/reflector_003_2.png"&gt;&lt;IMG style="BORDER-RIGHT-WIDTH: 0px; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" border=0 alt=reflector_003 src="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/ReflectoraddinFavorites_B37A/reflector_003_thumb.png" width=244 height=94 mce_src="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/ReflectoraddinFavorites_B37A/reflector_003_thumb.png"&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;I hope someone finds this useful. As always, use at your own risk, no warranties of any kind.&lt;/P&gt;
&lt;DIV style="PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; DISPLAY: inline; PADDING-TOP: 0px" id=scid:18d43e01-4549-4fde-8ca6-c7b4b7385fac:33b5cac4-367a-42b1-8494-175f042105e2 class=wlWriterSmartContent&gt;
&lt;DIV style="PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; DISPLAY: inline; PADDING-TOP: 0px" id=scid:18d43e01-4549-4fde-8ca6-c7b4b7385fac:33b5cac4-367a-42b1-8494-175f042105e2 class=wlWriterSmartContent&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV style="PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; DISPLAY: inline; PADDING-TOP: 0px" id=scid:18d43e01-4549-4fde-8ca6-c7b4b7385fac:70ab8a50-eb05-438e-b834-23ced95fbffb class=wlWriterSmartContent&gt;
&lt;DIV style="PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; DISPLAY: inline; PADDING-TOP: 0px" id=scid:18d43e01-4549-4fde-8ca6-c7b4b7385fac:70ab8a50-eb05-438e-b834-23ced95fbffb class=wlWriterSmartContent&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9320647" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-09-32-06-47/ReflectorFavorites.zip" length="41466" type="application/x-zip-compressed" /></item><item><title>Suppressing Personal Identifiable Information (PII) in WCF log files</title><link>http://blogs.msdn.com/b/martijnh/archive/2008/08/18/suppressing-personal-identifiable-information-pii-in-wcf-log-files.aspx</link><pubDate>Mon, 18 Aug 2008 23:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8877108</guid><dc:creator>martijnh1</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/martijnh/rsscomments.aspx?WeblogPostID=8877108</wfw:commentRss><comments>http://blogs.msdn.com/b/martijnh/archive/2008/08/18/suppressing-personal-identifiable-information-pii-in-wcf-log-files.aspx#comments</comments><description>&lt;P&gt;Given the vast amount of information transported between systems in today's enterprise environments, a lot of which is considered either private (addresses, social security numbers, credit card information, mortgage and pension plans, etc) or of high business value, information security is key.&lt;/P&gt;
&lt;P&gt;From the release of WCF, it has brought us tremendous flexibility and allowed development teams to be almost completely agnostic of the way information is transported between point A to point B, focusing on adding business value instead.&lt;/P&gt;
&lt;P&gt;Another great feature WCF brings us is runtime troubleshooting. In WCF, an administrator can simply enable &lt;A href="http://msdn.microsoft.com/en-us/library/ms731308.aspx" mce_href="http://msdn.microsoft.com/en-us/library/ms731308.aspx"&gt;logging&lt;/A&gt; to troubleshoot an environment which is in production.&lt;/P&gt;
&lt;P&gt;Although a great feature for troubleshooting, Personal Identifiable Information (PII) you care about deeply while on the wire (using transport and message-level security to protect it) is available in plain text if logging is turned on at the server side.&lt;/P&gt;
&lt;P&gt;WCF's logging features currently filter out specific PII by default (only if the message is not &lt;A href="http://msdn.microsoft.com/en-us/library/ms730318.aspx" mce_href="http://msdn.microsoft.com/en-us/library/ms730318.aspx"&gt;malformed&lt;/A&gt;). However, this functionality is not exposed to the developer.&lt;/P&gt;
&lt;P&gt;Consider the following scenario:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;You want the administrator to be able to monitor messages for auditing, logging or troubleshooting purposes; 
&lt;LI&gt;certain information is considered PII and should not show up in the log files.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;You could write your own logging subsystem and hook it in to your services. This takes a lot of work, is error prone, needs custom maintenance, documentation, etc.&lt;/P&gt;
&lt;P&gt;My proposal for the scenario:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Use a behavior which 
&lt;UL&gt;
&lt;LI&gt;introspects the published &lt;A href="http://msdn.microsoft.com/en-us/library/system.servicemodel.description.serviceendpoint.aspx" mce_href="http://msdn.microsoft.com/en-us/library/system.servicemodel.description.serviceendpoint.aspx"&gt;ServiceEndPoint&lt;/A&gt;s for published &lt;A href="http://msdn.microsoft.com/en-us/library/system.servicemodel.description.operationdescription.aspx" mce_href="http://msdn.microsoft.com/en-us/library/system.servicemodel.description.operationdescription.aspx"&gt;OperationDescription&lt;/A&gt;s and the used &lt;A href="http://msdn.microsoft.com/en-us/library/system.runtime.serialization.datacontractattribute.aspx" mce_href="http://msdn.microsoft.com/en-us/library/system.runtime.serialization.datacontractattribute.aspx"&gt;DataContract&lt;/A&gt;s, 
&lt;LI&gt;finds public properties on the DataContract marked as PII; 
&lt;LI&gt;instructs the WCF logging runtime to ignore the contents of the specified message elements.&lt;/LI&gt;&lt;/UL&gt;
&lt;LI&gt;configure the behavior through code (this is not generally considered a best practice, but the security needs of the service outweighs the flexibility needs of configuration);&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;Let's have a look at how the solution works:&lt;/P&gt;
&lt;P&gt;Take a DataContract, e.g. PurchaseOrder and apply an attribute (PII) on each property which represents PII.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/SuppressingPersonalIdentifiableInformati_C46F/wcf_pii_datacontract_2.png" mce_href="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/SuppressingPersonalIdentifiableInformati_C46F/wcf_pii_datacontract_2.png"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=174 alt=wcf_pii_datacontract src="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/SuppressingPersonalIdentifiableInformati_C46F/wcf_pii_datacontract_thumb.png" width=388 border=0 mce_src="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/SuppressingPersonalIdentifiableInformati_C46F/wcf_pii_datacontract_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Next, add a PIIProtectionBehavior attribute to your service implementation class&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/SuppressingPersonalIdentifiableInformati_C46F/wcf_pii_protectionbehavior_attribute_2.png" mce_href="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/SuppressingPersonalIdentifiableInformati_C46F/wcf_pii_protectionbehavior_attribute_2.png"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=107 alt=wcf_pii_protectionbehavior_attribute src="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/SuppressingPersonalIdentifiableInformati_C46F/wcf_pii_protectionbehavior_attribute_thumb.png" width=613 border=0 mce_src="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/SuppressingPersonalIdentifiableInformati_C46F/wcf_pii_protectionbehavior_attribute_thumb.png"&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;You're done. The PIIProtectionBehavior attribute is also an &lt;A href="http://msdn.microsoft.com/en-us/library/system.servicemodel.description.iservicebehavior.aspx" mce_href="http://msdn.microsoft.com/en-us/library/system.servicemodel.description.iservicebehavior.aspx"&gt;IServiceBehavior&lt;/A&gt; implementation which performs the introspection on the EndPoints.&lt;/P&gt;
&lt;P&gt;The result when logging is turned on:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/SuppressingPersonalIdentifiableInformati_C46F/wcf_pii_messagelogging_2.png" mce_href="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/SuppressingPersonalIdentifiableInformati_C46F/wcf_pii_messagelogging_2.png"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=135 alt=wcf_pii_messagelogging src="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/SuppressingPersonalIdentifiableInformati_C46F/wcf_pii_messagelogging_thumb.png" width=389 border=0 mce_src="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/SuppressingPersonalIdentifiableInformati_C46F/wcf_pii_messagelogging_thumb.png"&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;As you can see, 'CreditCardnumber' is no longer logged, it just displays '&amp;lt;-- Removed --&amp;gt;' .&lt;/P&gt;
&lt;P&gt;I've attached the sample code, hope it's useful!&lt;/P&gt;
&lt;P&gt;Ofcourse, the normal disclaimers apply, the accompanied sample is for educational purposes only, it has not gone through rigorous testing, might contain bugs due to limited testing (me ;-)), etc. Please see the sourcecode for further remarks.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8877108" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-08-87-71-08/PurchaseManagement.zip" length="15673" type="application/x-zip-compressed" /><category domain="http://blogs.msdn.com/b/martijnh/archive/tags/WCF/">WCF</category><category domain="http://blogs.msdn.com/b/martijnh/archive/tags/-NET/">.NET</category><category domain="http://blogs.msdn.com/b/martijnh/archive/tags/Security/">Security</category><category domain="http://blogs.msdn.com/b/martijnh/archive/tags/PII/">PII</category></item><item><title>Adding a new BizTalk Server Isolated Host needs a new Application Pool</title><link>http://blogs.msdn.com/b/martijnh/archive/2008/07/23/adding-a-new-biztalk-server-isolated-host-needs-a-new-application-pool.aspx</link><pubDate>Wed, 23 Jul 2008 12:29:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8766424</guid><dc:creator>martijnh1</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/martijnh/rsscomments.aspx?WeblogPostID=8766424</wfw:commentRss><comments>http://blogs.msdn.com/b/martijnh/archive/2008/07/23/adding-a-new-biztalk-server-isolated-host-needs-a-new-application-pool.aspx#comments</comments><description>Recently, we tried creating a secondary Isolated Host to separate receive and send processing for WCF. After reconfiguring the servers, we were faced with the "Receive location for address '&lt;location&gt;' not found. (The BizTalk receive location may be disabled)". Puzzled, we looked around for configuration issues. After some reading (http://technet.microsoft.com/en-us/library/aa559328.aspx), we remembered a new isolated host needs a new application pool. Adding another application pool to the mix the the new host fixed our trouble...

Jotted down for posterity ;-)&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8766424" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/martijnh/archive/tags/BizTalk+Server/">BizTalk Server</category><category domain="http://blogs.msdn.com/b/martijnh/archive/tags/WCF/">WCF</category><category domain="http://blogs.msdn.com/b/martijnh/archive/tags/Isolated+Hosts/">Isolated Hosts</category><category domain="http://blogs.msdn.com/b/martijnh/archive/tags/Application+Pool/">Application Pool</category></item><item><title>Running Virtual Machines under alternate user credentials on a Domain Controller</title><link>http://blogs.msdn.com/b/martijnh/archive/2008/05/02/running-virtual-machines-under-alternate-user-credentials-on-a-domain-controller.aspx</link><pubDate>Fri, 02 May 2008 16:43:51 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8450546</guid><dc:creator>martijnh1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/martijnh/rsscomments.aspx?WeblogPostID=8450546</wfw:commentRss><comments>http://blogs.msdn.com/b/martijnh/archive/2008/05/02/running-virtual-machines-under-alternate-user-credentials-on-a-domain-controller.aspx#comments</comments><description>&lt;h2 style="margin: 10pt 0in 0pt"&gt;&lt;strong&gt;&lt;font face="Cambria" color="#4f81bd" size="4"&gt;Introduction&lt;/font&gt;&lt;/strong&gt;&lt;/h2&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;Recently, I was experimenting with Team Foundation Server 2008, setting it up with SSL and running it within a test domain. For the Team Foundation Server, I couldn't use the host installation as it runs Windows Server 2003 R2 x64 edition and TFS doesn't support (see the &lt;/font&gt;&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=ff12844f-398c-4fe9-8b0d-9e84181d9923&amp;amp;displaylang=en"&gt;&lt;font face="Calibri" color="#800080" size="3"&gt;TFS installation guide&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri" size="3"&gt;, under 'Overview of Team Foundation Architecture', '64-bit Support in Team Foundation') this setup in a single server scenario. So, I installed &lt;/font&gt;&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=bc49c7c8-4840-4e67-8dc4-1e6e218acce4&amp;amp;displaylang=en"&gt;&lt;font face="Calibri" color="#800080" size="3"&gt;Virtual Server 2005 R2 SP1&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri" size="3"&gt;, installed TFS on top, configure SSL and voila, a working TFS setup. &lt;/font&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;When I shut down the host computer, I want the virtual machine of TFS to save state and come back up again when the host is turned on again. This can be done in Virtual Server using an alternative use running the actual Virtual Machine instance. Trying to set this up in a least privilege way proved not to be obvious from documentation, so this blog entry documents what I did for posterity (and myself ;-)).&lt;/font&gt;&lt;/p&gt; &lt;h2 style="margin: 10pt 0in 0pt"&gt;&lt;strong&gt;&lt;font face="Cambria" color="#4f81bd" size="4"&gt;Outline&lt;/font&gt;&lt;/strong&gt;&lt;/h2&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;Here's what needs to be done in order to circumvent obscure error messages:&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoListParagraphCxSpFirst" style="margin: 0in 0in 0pt 0.5in; text-indent: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;span style="mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: ignore"&gt;&lt;font face="Calibri" size="3"&gt;1.&lt;/font&gt;&lt;span style="font: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Calibri" size="3"&gt;We need a new user group so the account we'll use doesn't belong to default domain users and inherits no permissions.&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; text-indent: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;span style="mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: ignore"&gt;&lt;font face="Calibri" size="3"&gt;2.&lt;/font&gt;&lt;span style="font: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Calibri" size="3"&gt;We need a new user to run the Virtual Machine instance, the user should belong to this group only.&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; text-indent: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;span style="mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: ignore"&gt;&lt;font face="Calibri" size="3"&gt;3.&lt;/font&gt;&lt;span style="font: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Calibri" size="3"&gt;The user needs to be given 'Local on locally' rights.&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; text-indent: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;span style="mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: ignore"&gt;&lt;font face="Calibri" size="3"&gt;4.&lt;/font&gt;&lt;span style="font: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Calibri" size="3"&gt;Permissions need to be set on the folder containing network configuration information for Virtual Server.&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; text-indent: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;span style="mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: ignore"&gt;&lt;font face="Calibri" size="3"&gt;5.&lt;/font&gt;&lt;span style="font: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Calibri" size="3"&gt;Permissions need to be set on the folder containing the Virtual Machine and the actual files (*.vhd, .vmc) making up the Virtual Machine.&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoListParagraphCxSpLast" style="margin: 0in 0in 10pt 0.5in; text-indent: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;span style="mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: ignore"&gt;&lt;font face="Calibri" size="3"&gt;6.&lt;/font&gt;&lt;span style="font: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Calibri" size="3"&gt;The Virtual Machine needs to be configured to use the new user.&lt;/font&gt;&lt;/p&gt; &lt;h2 style="margin: 10pt 0in 0pt"&gt;&lt;strong&gt;&lt;font face="Cambria" color="#4f81bd" size="4"&gt;Instuctions&lt;/font&gt;&lt;/strong&gt;&lt;/h2&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;Let's configure the necessary elements. &lt;/font&gt;&lt;/p&gt; &lt;h3 style="margin: 10pt 0in 0pt"&gt;&lt;strong&gt;&lt;font face="Cambria" color="#4f81bd" size="3"&gt;1. Create a new group&lt;/font&gt;&lt;/strong&gt;&lt;/h3&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;Create a new group within the Active Directory Users and Computers MMC snapin (found under Administration Tools):&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;a href="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/RunningVirtualMachinesunderalternateuser_DA40/emptygroup_2.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="410" alt="emptygroup" src="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/RunningVirtualMachinesunderalternateuser_DA40/emptygroup_thumb.png" width="369" border="0"&gt;&lt;/a&gt; &lt;/p&gt; &lt;h3 style="margin: 10pt 0in 0pt"&gt;&lt;strong&gt;&lt;font face="Cambria" color="#4f81bd" size="3"&gt;2. Create a new user&lt;/font&gt;&lt;/strong&gt;&lt;/h3&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;Create the user which is to run the specific Virtual Machine (done from the same MMC snap-in), add it to the 'empty' group, set the 'empty' group as it's Primary Group and remove the 'Domain Users' group from the list. After this, your user overview should resemble this image:&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;a href="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/RunningVirtualMachinesunderalternateuser_DA40/vmuser_2.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="446" alt="vmuser" src="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/RunningVirtualMachinesunderalternateuser_DA40/vmuser_thumb.png" width="372" border="0"&gt;&lt;/a&gt; &lt;/p&gt; &lt;h3 style="margin: 10pt 0in 0pt"&gt;&lt;strong&gt;&lt;font face="Cambria" color="#4f81bd" size="3"&gt;3. Assign 'Log on locally' rights to the user&lt;/font&gt;&lt;/strong&gt;&lt;/h3&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;This step is critical in getting the Virtual Machine running under the new user context. Steps to achieve the appropriate right setting are described &lt;/font&gt;&lt;a href="http://support.microsoft.com/kb/234237"&gt;&lt;font face="Calibri" color="#800080" size="3"&gt;here&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri" size="3"&gt;. If the user doesn't receive the 'Log on locally' right, Virtual Server will display an error: '&lt;i style="mso-bidi-font-style: normal"&gt;The account name and password could not be set. The virtual machine account could not be set. The account has not been granted the requested logon type.&lt;/i&gt;'. Make sure the security policy is updated before using the account.&lt;/font&gt;&lt;/p&gt; &lt;h3 style="margin: 10pt 0in 0pt"&gt;&lt;strong&gt;&lt;font face="Cambria" color="#4f81bd" size="3"&gt;4. Set permissions for the used virtual network interface&lt;/font&gt;&lt;/strong&gt;&lt;/h3&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;Now that we have the user and it's group configured, let's set the appropriate permissions for the user to make use of the configured network. Mind you, these instructions will only allow the user to use the network it's given access to from the instructions, the 'local network only' et al will not work as the user has no rights on the files used for those configurations.&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;The virtual network configuration files for Virtual Server are stored in &lt;i style="mso-bidi-font-style: normal"&gt;%SystemDrive%\Documents and Settings\All Users\Application Data\Microsoft\Virtual Server\Virtual Networks&lt;/i&gt;. The user needs permissions as &lt;/font&gt;&lt;a href="http://www.microsoft.com/technet/prodtechnol/virtualserver/2005/proddocs/vs_operate_using_secure_vm.mspx"&gt;&lt;font face="Calibri" color="#800080" size="3"&gt;specified&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri" size="3"&gt; in order to use the network. If permissions are set incorrectly, the Virtual Machine will not have network access.&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;a href="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/RunningVirtualMachinesunderalternateuser_DA40/networkpermissions_2.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="480" alt="networkpermissions" src="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/RunningVirtualMachinesunderalternateuser_DA40/networkpermissions_thumb.png" width="377" border="0"&gt;&lt;/a&gt; &lt;/p&gt; &lt;h3 style="margin: 10pt 0in 0pt"&gt;&lt;strong&gt;&lt;font face="Cambria" color="#4f81bd" size="3"&gt;5. Set permissions on Virtual Machine folders and files&lt;/font&gt;&lt;/strong&gt;&lt;/h3&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;In order to start up the Virtual Machine, save state, etc, the new user needs access rights on the folder storing the actual files making up the Virtual Machine as well as specific rights on the Virtual Machine files. The folder structure containing my Virtual Machine files is:&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;i style="mso-bidi-font-style: normal"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;%SystemDrive%\vms\&amp;lt;Virtual Machine&amp;gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/i&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;First, let's set the appropriate rights on the folder hosting all Virtual Machines:&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;a href="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/RunningVirtualMachinesunderalternateuser_DA40/mainvmfolderpermissions_2.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="486" alt="mainvmfolderpermissions" src="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/RunningVirtualMachinesunderalternateuser_DA40/mainvmfolderpermissions_thumb.png" width="382" border="0"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;Now, let's set the permissions for the appropriate Virtual Machine ('&lt;i style="mso-bidi-font-style: normal"&gt;tfs&lt;/i&gt;') folder:&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;a href="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/RunningVirtualMachinesunderalternateuser_DA40/vmfolderpermissions_2.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="498" alt="vmfolderpermissions" src="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/RunningVirtualMachinesunderalternateuser_DA40/vmfolderpermissions_thumb.png" width="391" border="0"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;Lastly, set up permissions for the Virtual Machine files (my TFS has 3: &lt;i style="mso-bidi-font-style: normal"&gt;tfs.vmc&lt;/i&gt;, &lt;i style="mso-bidi-font-style: normal"&gt;tfs.vhd&lt;/i&gt; and &lt;i style="mso-bidi-font-style: normal"&gt;sql.vhd&lt;/i&gt;):&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;a href="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/RunningVirtualMachinesunderalternateuser_DA40/vmpermissions_2.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="509" alt="vmpermissions" src="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/RunningVirtualMachinesunderalternateuser_DA40/vmpermissions_thumb.png" width="400" border="0"&gt;&lt;/a&gt; &lt;/p&gt; &lt;h3 style="margin: 10pt 0in 0pt"&gt;&lt;strong&gt;&lt;font face="Cambria" color="#4f81bd" size="3"&gt;6. Configure the Virtual Machine&lt;/font&gt;&lt;/strong&gt;&lt;/h3&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;All permissions are set, we're ready to configure Virtual Server to run the Virtual Machine under the new user context:&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;a href="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/RunningVirtualMachinesunderalternateuser_DA40/configure%20virtual%20machine_2.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="369" alt="configure virtual machine" src="http://blogs.msdn.com/blogfiles/martijnh/WindowsLiveWriter/RunningVirtualMachinesunderalternateuser_DA40/configure%20virtual%20machine_thumb.png" width="822" border="0"&gt;&lt;/a&gt; &lt;/p&gt; &lt;h3 style="margin: 10pt 0in 0pt"&gt;&lt;strong&gt;&lt;font face="Cambria" color="#4f81bd" size="3"&gt;Wrap up&lt;/font&gt;&lt;/strong&gt;&lt;/h3&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;That's it! We've configured the Virtual Machine to run under a user context which has the least amount of privileges it needs to function correctly. The Virtual Machine will save it's state when the host is shut down and will automatically turn back on when the host comes back online.&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;HTH&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8450546" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/martijnh/archive/tags/Team+Foundation+Server/">Team Foundation Server</category><category domain="http://blogs.msdn.com/b/martijnh/archive/tags/Active+Directory/">Active Directory</category><category domain="http://blogs.msdn.com/b/martijnh/archive/tags/Virtual+Server/">Virtual Server</category><category domain="http://blogs.msdn.com/b/martijnh/archive/tags/TFS/">TFS</category></item><item><title>Fixing exception messages on the .NET Compact Framework 3.5</title><link>http://blogs.msdn.com/b/martijnh/archive/2008/01/03/fixing-exception-messages-on-the-net-compact-framework-3-5.aspx</link><pubDate>Thu, 03 Jan 2008 19:04:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6969321</guid><dc:creator>martijnh1</dc:creator><slash:comments>17</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/martijnh/rsscomments.aspx?WeblogPostID=6969321</wfw:commentRss><comments>http://blogs.msdn.com/b/martijnh/archive/2008/01/03/fixing-exception-messages-on-the-net-compact-framework-3-5.aspx#comments</comments><description>&lt;P&gt;FWIW: I&amp;nbsp;recently ran into trouble while developing for the .NET Compact Framework, v3.5. Upon all exceptions, the framework would tell me: &lt;/P&gt;
&lt;P&gt;"&lt;EM&gt;An error message is available for this exception but cannot be displayed because these messages are optional and are not currently installed on this device. Please install ‘NETCFv35.Messages.EN.wm.cab’ for Windows Mobile 5.0 and above or&amp;nbsp; ‘NETCFv35.Messages.EN.cab’ for other platforms. Restart the application to see the message.&lt;/EM&gt;"&lt;/P&gt;
&lt;P&gt;Interpreting the message as 'I have to run the NETCFv35.Messages.EN.wm.cab (I'm developing an application for WM6) on my device', I copied the file from C:\Program Files (x86)\Microsoft.NET\SDK\CompactFramework\v3.5\WindowsCE\Diagnostics onto my mobile device and ran the installation.&lt;/P&gt;
&lt;P&gt;To no avail, nothing changed and I was stuck. After installing the '&lt;A class="" href="http://www.microsoft.com/Downloads/thankyou.aspx?familyId=c8174c14-a27d-4148-bf01-86c2e0953eab&amp;amp;displayLang=en" mce_href="http://www.microsoft.com/Downloads/thankyou.aspx?familyId=c8174c14-a27d-4148-bf01-86c2e0953eab&amp;amp;displayLang=en"&gt;Power Toys for .NET Compact Framework 3.5&lt;/A&gt;', however, I configured logging using the '.NETCF Logging Configuration' application and found the following error for the &lt;EM&gt;loader&lt;/EM&gt; log:&lt;/P&gt;
&lt;P&gt;'Attempt to load [\Program Files\SomeApp\System.SR.dll] has failed (err 0x80001000).'&lt;/P&gt;
&lt;P&gt;Renaming the file 'SYCCFA~1.001', included in the aforementioned CAB file into System.SR.dll and adding it as a reference in my application proved to fix the issue. I now had readable exception messages.&lt;/P&gt;
&lt;P&gt;Just jotting this down&amp;nbsp;as there's nothing to be found on the web regarding the issue that I could find. &lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=6969321" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/martijnh/archive/tags/Resources/">Resources</category><category domain="http://blogs.msdn.com/b/martijnh/archive/tags/Logging/">Logging</category><category domain="http://blogs.msdn.com/b/martijnh/archive/tags/NET/">NET</category><category domain="http://blogs.msdn.com/b/martijnh/archive/tags/-NET+Compact+Framework+3-5/">.NET Compact Framework 3.5</category><category domain="http://blogs.msdn.com/b/martijnh/archive/tags/3-5/">3.5</category><category domain="http://blogs.msdn.com/b/martijnh/archive/tags/Compact/">Compact</category><category domain="http://blogs.msdn.com/b/martijnh/archive/tags/Framework/">Framework</category><category domain="http://blogs.msdn.com/b/martijnh/archive/tags/Exceptions/">Exceptions</category><category domain="http://blogs.msdn.com/b/martijnh/archive/tags/-NET/">.NET</category></item><item><title>Testing WCF service implementations</title><link>http://blogs.msdn.com/b/martijnh/archive/2007/05/17/testing-wcf-service-implementations.aspx</link><pubDate>Thu, 17 May 2007 14:21:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2693798</guid><dc:creator>martijnh1</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/martijnh/rsscomments.aspx?WeblogPostID=2693798</wfw:commentRss><comments>http://blogs.msdn.com/b/martijnh/archive/2007/05/17/testing-wcf-service-implementations.aspx#comments</comments><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;FONT face=Calibri size=3&gt;When writing WCF implementations, or any code for that matter, testing is an important part of the process. This week, I was building tests for implemented WCF services and had difficulty aligning all the external dependencies of the tests (running hosts, configuration settings, behavior component references, etc). As a result, I set up my WCF services to be self-hosted services, run from the context of the test itself. This has several advantages, and some pitfalls. The advantages:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; TEXT-ALIGN: justify; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Isolation, the test has external dependencies only to the actual service implementation.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpLast style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; TEXT-ALIGN: justify; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;No manual setup running hosts to ensure they are available, the test ‘just works’.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;FONT face=Calibri size=3&gt;The pitfall might be:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; TEXT-ALIGN: justify; mso-list: l1 level1 lfo2"&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Configuration settings could become out-of-sync. Because the host of the service implementation runs within the context of the test and thereby it’s AppDomain, you need to configure the service ABCs within the test configuration file. This could mean over time you’d get configuration settings for the tests no longer in sync with the actual host. &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;FONT face=Calibri size=3&gt;However, because the scope of the tests is under your control and so is it’s configuration, the described pitfall might not pose an issue.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;FONT face=Calibri size=3&gt;In order for the test to host it’s own instance of the services to be tested I created a generic container. It’s a simple, but effective, class which can easily host different service types (all tracing and the &lt;/FONT&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; LINE-HEIGHT: 110%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;A href="http://msdn2.microsoft.com/en-us/library/b1yfkh5e(vs.71).aspx" mce_href="http://msdn2.microsoft.com/en-us/library/b1yfkh5e(vs.71).aspx"&gt;&lt;SPAN style="COLOR: #2b91af; TEXT-DECORATION: none; text-underline: none"&gt;IDisposable&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 110%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;implementation removed for clarity):&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;///&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;summary&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;///&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Defines a generic implementation of a runnable background host.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;///&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;/summary&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;///&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;typeparam name="T"&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;The service to run within the host.&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;/typeparam&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;public&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;class&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;RunnableBackgroundHost&lt;/SPAN&gt;&amp;lt;T&amp;gt; : &lt;SPAN style="COLOR: #2b91af"&gt;&lt;A href="http://msdn2.microsoft.com/en-us/library/b1yfkh5e(vs.71).aspx" mce_href="http://msdn2.microsoft.com/en-us/library/b1yfkh5e(vs.71).aspx"&gt;&lt;SPAN style="COLOR: #2b91af; TEXT-DECORATION: none; text-underline: none"&gt;IDisposable&lt;/SPAN&gt;&lt;/A&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;where&lt;/SPAN&gt; T : &lt;SPAN style="COLOR: blue"&gt;class&lt;/SPAN&gt;, &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt;() &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;internal&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: #2b91af"&gt;AutoResetEvent&lt;/SPAN&gt; stopEvent = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;AutoResetEvent&lt;/SPAN&gt;(&lt;SPAN style="COLOR: blue"&gt;false&lt;/SPAN&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;///&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;summary&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;///&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Starts the host on a new thread.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;///&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;/summary&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;public&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; Run()&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;ThreadPool&lt;/SPAN&gt;.QueueUserWorkItem(&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;new&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: #2b91af"&gt;WaitCallback&lt;/SPAN&gt;(&lt;SPAN style="COLOR: blue"&gt;delegate&lt;/SPAN&gt;(&lt;SPAN style="COLOR: blue"&gt;object&lt;/SPAN&gt; state)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;using&lt;/SPAN&gt; (&lt;SPAN style="COLOR: #2b91af"&gt;ServiceHost&lt;/SPAN&gt; host = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;ServiceHost&lt;/SPAN&gt;(&lt;SPAN style="COLOR: blue"&gt;typeof&lt;/SPAN&gt;(T)))&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;host.Open();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;stopEvent.WaitOne();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;host.Close();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}));&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;///&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;summary&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;///&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; Stops the running host.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;///&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;/summary&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;public&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; Stop()&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;stopEvent.Set();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;FONT face=Calibri size=3&gt;Using this class, testing services become quite easy. Set up the host before starting the test:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;[System.Diagnostics.CodeAnalysis.&lt;SPAN style="COLOR: #2b91af"&gt;SuppressMessage&lt;/SPAN&gt;(&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;"Microsoft.Performance"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;, &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;"CA1812:AvoidUninstantiatedInternalClasses"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;), &lt;SPAN style="COLOR: #2b91af"&gt;TestClass&lt;/SPAN&gt;]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;class&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: #2b91af"&gt;HostInit&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;protected&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;RunnableBackgroundHost&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;Service1&lt;/SPAN&gt;&amp;gt; service1;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;protected&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;RunnableBackgroundHost&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;Service2&lt;/SPAN&gt;&amp;gt; service2;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;[&lt;SPAN style="COLOR: #2b91af"&gt;AssemblyInitialize&lt;/SPAN&gt;]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;public&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; AssemblyInitalize(&lt;SPAN style="COLOR: #2b91af"&gt;TestContext&lt;/SPAN&gt; context)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;service1 = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;RunnableBackgroundHost&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;Service1&lt;/SPAN&gt;&amp;gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;service2 = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;RunnableBackgroundHost&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;Service2&lt;/SPAN&gt;&amp;gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;service1.Run();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;service2.Run();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;[&lt;SPAN style="COLOR: #2b91af"&gt;AssemblyCleanup&lt;/SPAN&gt;]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;public&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; AssemblyCleanup()&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;service1.Stop();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;service2.Stop();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;FONT face=Calibri size=3&gt;And set up your test, using a generated proxy (svcutil) and assuming the service is alive:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;[&lt;SPAN style="COLOR: #2b91af"&gt;TestClass&lt;/SPAN&gt;]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;public&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;class&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Service1&lt;/SPAN&gt;Tests&lt;/SPAN&gt; : &lt;SPAN style="COLOR: #2b91af"&gt;IDisposable&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;private&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: #2b91af"&gt;Service1Client&lt;/SPAN&gt; service1Client;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;[&lt;SPAN style="COLOR: #2b91af"&gt;TestInitialize&lt;/SPAN&gt;]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;public&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; TestInitialize()&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;service1Client = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Service1Client&lt;/SPAN&gt;&lt;/SPAN&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;[&lt;SPAN style="COLOR: #2b91af"&gt;TestMethod&lt;/SPAN&gt;]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;public&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; TestService1Method1()&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Service1Request&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; request = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;Service1Request&lt;/SPAN&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;request.Id = &lt;SPAN style="COLOR: #a31515"&gt;"1"&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;Service1Response&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; response = service1Client.Method1(request);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Assert&lt;/SPAN&gt;.IsNotNull(response, &lt;SPAN style="COLOR: #2b91af"&gt;ErrorMessages&lt;/SPAN&gt;.NullResponse);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Assert&lt;/SPAN&gt;.AreEqual&amp;lt;&lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt;&amp;gt;(&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;response.Field, &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;1, &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;ErrorMessages&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;.NonMatchingId);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 110%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 110%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; LINE-HEIGHT: 110%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;ErrorMessages&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt; is a simple resource file containing the messages the test would display in case of failure.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;FONT face=Calibri size=3&gt;What the test framework does in this case:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-list: l1 level1 lfo2; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Call the static method &lt;/FONT&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;HostInit&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;.&lt;/FONT&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;AssemblyInitalize &lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;marked with &lt;/FONT&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;[&lt;SPAN style="COLOR: #2b91af"&gt;AssemblyInitialize&lt;/SPAN&gt;]&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-list: l1 level1 lfo2; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol; mso-no-proof: yes"&gt;&lt;SPAN style="mso-list: Ignore"&gt;·&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;For every class within the test marked with &lt;/FONT&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;[&lt;SPAN style="COLOR: #2b91af"&gt;TestClass&lt;/SPAN&gt;]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-list: l1 level2 lfo2; mso-layout-grid-align: none; mso-add-space: auto" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-list: Ignore"&gt;o&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Call any instance method marked with &lt;/FONT&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;[&lt;SPAN style="COLOR: #2b91af"&gt;TestInitialize&lt;/SPAN&gt;]&lt;/SPAN&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;.&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-list: l1 level2 lfo2; mso-layout-grid-align: none; mso-add-space: auto" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-list: Ignore"&gt;o&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Run any method marked with &lt;/FONT&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;[&lt;SPAN style="COLOR: #2b91af"&gt;TestMethod&lt;/SPAN&gt;]&lt;/SPAN&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;.&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-list: l1 level2 lfo2; mso-layout-grid-align: none; mso-add-space: auto" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-list: Ignore"&gt;o&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;...&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpLast style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-list: l1 level1 lfo2; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Call the static method &lt;/FONT&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;HostInit&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;.&lt;/FONT&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;AssemblyCleanup &lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;marked with &lt;/FONT&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;[&lt;SPAN style="COLOR: #2b91af"&gt;AssemblyCleanup&lt;/SPAN&gt;]&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;FONT face=Calibri size=3&gt;Within the test configuration file, configure both the service host and the client:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;system.serviceModel&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;client&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;endpoint&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;address&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;"&lt;SPAN style="COLOR: blue"&gt;http://localhost:8889/Services/Service1&lt;/SPAN&gt;"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;"&lt;SPAN style="COLOR: blue"&gt;basicHttpBinding&lt;/SPAN&gt;"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;contract&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;"&lt;SPAN style="COLOR: blue"&gt;IService1&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt; /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;client&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;services&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;service&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;/SPAN&gt;&lt;SPAN lang=NL style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-ansi-language: NL"&gt;name&lt;/SPAN&gt;&lt;SPAN lang=NL style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-ansi-language: NL"&gt;=&lt;/SPAN&gt;&lt;SPAN lang=NL style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes; mso-ansi-language: NL"&gt;"&lt;SPAN style="COLOR: blue"&gt;Service1&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;endpoint&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 1.5in; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;address&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;"&lt;SPAN style="COLOR: blue"&gt;http://localhost:8889/Services/Service1&lt;/SPAN&gt;"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 1.5in; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;"&lt;SPAN style="COLOR: blue"&gt;basicHttpBinding&lt;/SPAN&gt;"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 1.5in; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;contract&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;"&lt;SPAN style="COLOR: blue"&gt;IService1&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt; /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;service&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;services&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;system.serviceModel&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;FONT face=Calibri size=3&gt;That’s the basic setup. You can now easily test different services by defining the tests for it in it’s own class using it’s own generated client proxy and adding the service to the &lt;/FONT&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;HostInit&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt; class. You could test behaviors by adding them to the configuration file and writing a test for them if they can be tested from the outside.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;FONT face=Calibri size=3&gt;Just press SHIFT+ALT+X to run the test in the debugger. No console windows popping up, your test just executes :).&lt;/FONT&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2693798" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/martijnh/archive/tags/WCF/">WCF</category><category domain="http://blogs.msdn.com/b/martijnh/archive/tags/Testing/">Testing</category></item><item><title>WCF Message validation (1) – WCF samples to the rescue</title><link>http://blogs.msdn.com/b/martijnh/archive/2007/05/13/wcf-message-validation-1-wcf-samples-to-the-rescue.aspx</link><pubDate>Sun, 13 May 2007 14:12:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2597622</guid><dc:creator>martijnh1</dc:creator><slash:comments>7</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/martijnh/rsscomments.aspx?WeblogPostID=2597622</wfw:commentRss><comments>http://blogs.msdn.com/b/martijnh/archive/2007/05/13/wcf-message-validation-1-wcf-samples-to-the-rescue.aspx#comments</comments><description>&lt;SPAN style="FONT-SIZE: 10pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;&lt;FONT face=Calibri&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;Recently, I needed to validatie messages going into a WCF service. It turned out the WCF samples are a rich source of knowledge and I found a sample which&amp;nbsp;performs XMLSchema-based validation in \TechnologySamples\Extensibility\MessageInspectors. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;The sample contains a few classes:&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;UL type=disc&gt;
&lt;LI class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l1 level1 lfo1; tab-stops: list .5in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;ClientValidationException.cs&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;UL type=circle&gt;
&lt;LI class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l1 level2 lfo1; tab-stops: list 1.0in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;Defines exceptions where validation fails clientside&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;LI class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l1 level1 lfo1; tab-stops: list .5in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;SchemaValidationBehavior.cs&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;UL type=circle&gt;
&lt;LI class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l1 level2 lfo1; tab-stops: list 1.0in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;Defines an implementation of &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"&gt;&lt;A href="http://msdn2.microsoft.com/en-us/library/system.servicemodel.description.iendpointbehavior.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/system.servicemodel.description.iendpointbehavior.aspx"&gt;&lt;SPAN style="COLOR: #2b91af; TEXT-DECORATION: none; text-underline: none"&gt;IEndpointBehavior&lt;/SPAN&gt;&lt;/A&gt; &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;in order to be an extender for defined endpoints&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;LI class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l1 level1 lfo1; tab-stops: list .5in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;SchemaValidationBehaviorExtensionElement.cs&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;UL type=circle&gt;
&lt;LI class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l1 level2 lfo1; tab-stops: list 1.0in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;Inherits from &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"&gt;&lt;A href="http://msdn2.microsoft.com/en-us/library/system.servicemodel.configuration.behaviorextensionelement.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/system.servicemodel.configuration.behaviorextensionelement.aspx"&gt;&lt;SPAN style="COLOR: #2b91af; TEXT-DECORATION: none; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: no; text-underline: none; mso-bidi-theme-font: minor-bidi"&gt;BehaviorExtensionElement&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;, used for configuration-time binding&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;LI class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l1 level1 lfo1; tab-stops: list .5in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;SchemaValidationMessageInspector.cs&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;UL type=circle&gt;
&lt;LI class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l1 level2 lfo1; tab-stops: list 1.0in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;Contains the actual validation code, implementing &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"&gt;&lt;A href="http://msdn2.microsoft.com/en-us/library/system.servicemodel.dispatcher.iclientmessageinspector.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/system.servicemodel.dispatcher.iclientmessageinspector.aspx"&gt;&lt;SPAN style="COLOR: #2b91af; TEXT-DECORATION: none; text-underline: none"&gt;IClientMessageInspector&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt; and &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"&gt;&lt;A href="http://msdn2.microsoft.com/en-us/library/system.servicemodel.dispatcher.idispatchmessageinspector.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/system.servicemodel.dispatcher.idispatchmessageinspector.aspx"&gt;&lt;SPAN style="COLOR: #2b91af; TEXT-DECORATION: none; text-underline: none"&gt;IDispatchMessageInspector&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;LI class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l1 level1 lfo1; tab-stops: list .5in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;ValidationFault.cs&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;UL type=circle&gt;
&lt;LI class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l1 level2 lfo1; tab-stops: list 1.0in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;Defines &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"&gt;&lt;A href="http://msdn2.microsoft.com/en-us/library/system.servicemodel.faultexception.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/system.servicemodel.faultexception.aspx"&gt;&lt;SPAN style="COLOR: #2b91af; TEXT-DECORATION: none; text-underline: none"&gt;FaultException&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;s used within the code.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman'"&gt;The sample uses a property called Schemas within it’s configuration, allowing us to define which schemas should be taken into account when validating.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;schemaValidator&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;validateRequest&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;"&lt;SPAN style="COLOR: blue"&gt;True&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;validateReply&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;True&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;schemas&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;add&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;location&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;"&lt;SPAN style="COLOR: blue"&gt;messages.xsd&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt; /&amp;gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;schemas&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;schemaValidator&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;That’s great, but as you all probably know, WCF services have the ABC’s: Address, Binding and Contract. What I actually wanted the behavior to do was validate my message against the actual Contract of the endpoint the validator was working on.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;In order for this to work, I did two thing:&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l0 level1 lfo2; mso-add-space: auto" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l0 level1 lfo2; mso-add-space: auto" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;1.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;I removed all “Schemas” configuration and arguments from the code.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpLast style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l0 level1 lfo2; mso-add-space: auto" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;SPAN style="mso-list: Ignore"&gt;2.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;I modified the SchemaValidationBehavior class to validate the actual contract.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;The first steps should be self-explanatory, but the second I want to elaborate on. What I actually did was modify the methods &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;ApplyClientBehavior&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"&gt; and &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;ApplyDispatchBehavior&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;. The sample took the configured Schemas property to create the actual &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;SchemaValidationMessageInspector&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;:&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;SchemaValidationMessageInspector&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; inspector = &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;new&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: #2b91af"&gt;SchemaValidationMessageInspector&lt;/SPAN&gt;(&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;schemaSet&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;, validateRequest, validateReply, &lt;SPAN style="COLOR: blue"&gt;false&lt;/SPAN&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;I wanted to dynamically use the endpoint contract:&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;/SPAN&gt;&lt;/B&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;WsdlExporter&lt;/SPAN&gt;&lt;/B&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; exporter = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;WsdlExporter&lt;/SPAN&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;exporter.ExportContract(endpoint.Contract);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;SchemaValidationMessageInspector&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; inspector = &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;new&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: #2b91af"&gt;SchemaValidationMessageInspector&lt;/SPAN&gt;(&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;exporter.GeneratedXmlSchemas&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;, &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;validateRequest, validateReply, &lt;SPAN style="COLOR: blue"&gt;false&lt;/SPAN&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;After modifying both methods to perform this kind of setup, it was easy to configure validation based on the endpoint contract (some elements abbreviated for clarity):&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;system.serviceModel&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;services&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;service&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;name&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;"&lt;SPAN style="COLOR: blue"&gt;SomeService&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 1.5in; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;endpoint&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 1.5in; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;address&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;"&lt;SPAN style="COLOR: blue"&gt;SomeAddress&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 1.5in; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;binding&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;"&lt;SPAN style="COLOR: blue"&gt;wsHttpBinding&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 1.5in; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;contract&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;"&lt;SPAN style="COLOR: blue"&gt; ISomeService&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 2in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;behaviorConfiguration&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;"&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="COLOR: blue"&gt;SomeServiceEndpointBehavior&lt;/SPAN&gt;&lt;/B&gt;"&lt;SPAN style="COLOR: blue"&gt; /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;service&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;services&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;behaviors&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;endpointBehaviors&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;behavior&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;name&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;"&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="COLOR: blue"&gt;SomeServiceEndpointBehavior&lt;/SPAN&gt;&lt;/B&gt;"&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 1.5in; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;/SPAN&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;SchemaValidator&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 2in; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;validateRequest&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;"&lt;SPAN style="COLOR: blue"&gt;True&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 2in; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;validateReply&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;"&lt;SPAN style="COLOR: blue"&gt;True&lt;/SPAN&gt;" /&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;behavior&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;endpointBehaviors&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;behaviors&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;extensions&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;behaviorExtensions&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;add&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 1.5in; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;name&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;"&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="COLOR: blue"&gt;SchemaValidator&lt;/SPAN&gt;&lt;/B&gt;"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 1.5in; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;type&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;=&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;"&lt;SPAN style="COLOR: blue"&gt;SchemaValidationBehaviorExtensionElement, ...&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;/&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;behaviorExtensions&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;extensions&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #a31515; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;system.serviceModel&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;That’s it, now we have a service endpoint validated based on it’s WSDL contract.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; TEXT-ALIGN: left; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" align=left&gt;&lt;SPAN style="FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: Arial"&gt;The sample code is attached for your enjoyment.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2597622" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-02-59-76-22/messageinspectors.zip" length="25299" type="application/x-zip-compressed" /><category domain="http://blogs.msdn.com/b/martijnh/archive/tags/WCF/">WCF</category></item><item><title>Shockwave Flash preview handler for Windows Vista and Outlook 2007.</title><link>http://blogs.msdn.com/b/martijnh/archive/2007/05/02/shockwave-flash-preview-handler-for-windows-vista-and-outlook-2007.aspx</link><pubDate>Wed, 02 May 2007 14:27:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2372878</guid><dc:creator>martijnh1</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/martijnh/rsscomments.aspx?WeblogPostID=2372878</wfw:commentRss><comments>http://blogs.msdn.com/b/martijnh/archive/2007/05/02/shockwave-flash-preview-handler-for-windows-vista-and-outlook-2007.aspx#comments</comments><description>&lt;P&gt;Based on the excellent &lt;A class="" href="http://msdn.microsoft.com/msdnmag/issues/07/01/PreviewHandlers/default.aspx" mce_href="http://msdn.microsoft.com/msdnmag/issues/07/01/PreviewHandlers/default.aspx"&gt;article&lt;/A&gt; from &lt;A class="" href="http://blogs.msdn.com/toub/" mce_href="http://blogs.msdn.com/toub/"&gt;Stephen Toub&lt;/A&gt;, I was inspired to write a Shockwave Flash preview handler. Basically, it's just a plain UserControl which hosts the ActiveX wrapper for the player. It works from both Outlook 2007 and Windows Vista. The installer is attached.&lt;/P&gt;
&lt;P&gt;&lt;IMG title="Shockwave Flash preview handler in action" style="WIDTH: 317px; HEIGHT: 523px" height=523 alt="Shockwave Flash preview handler in action" src="http://home.orange.nl/martijnhoogendoorn/SwfPreviewHandler.png" width=317 align=absMiddle mce_src="http://home.orange.nl/martijnhoogendoorn/SwfPreviewHandler.png"&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2372878" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-02-37-28-78/SwfPreviewHandlers.msi" length="422400" type="application/octet-stream" /><category domain="http://blogs.msdn.com/b/martijnh/archive/tags/Outlook+2007/">Outlook 2007</category><category domain="http://blogs.msdn.com/b/martijnh/archive/tags/Vista/">Vista</category><category domain="http://blogs.msdn.com/b/martijnh/archive/tags/Preview+handler/">Preview handler</category></item><item><title>Programmatic BizTalk Server Orchestrations - code repost</title><link>http://blogs.msdn.com/b/martijnh/archive/2007/04/06/programmatic-biztalk-server-orchestrations-code-repost.aspx</link><pubDate>Fri, 06 Apr 2007 17:30:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2040323</guid><dc:creator>martijnh1</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/martijnh/rsscomments.aspx?WeblogPostID=2040323</wfw:commentRss><comments>http://blogs.msdn.com/b/martijnh/archive/2007/04/06/programmatic-biztalk-server-orchestrations-code-repost.aspx#comments</comments><description>&lt;P&gt;A previous &lt;A class="" href="http://martijnh.blogspot.com/2005/11/programmatically-creating-biztalk.html" mce_href="http://martijnh.blogspot.com/2005/11/programmatically-creating-biztalk.html"&gt;post&lt;/A&gt; of mine had some sample code on creating BizTalk Server Orchestrations programmatically, opening up template based guidance packages. The sourcecode for the sample can now be found &lt;A class="" href="http://home.orange.nl/martijnhoogendoorn/ProgrammaticBizTalkOrchestrations.zip" mce_href="http://home.orange.nl/martijnhoogendoorn/ProgrammaticBizTalkOrchestrations.zip"&gt;here&lt;/A&gt;.&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2040323" width="1" height="1"&gt;</description></item><item><title>BizTalk Server Pipeline Component Wizard moved</title><link>http://blogs.msdn.com/b/martijnh/archive/2007/03/12/biztalk-server-pipeline-component-wizard-moved.aspx</link><pubDate>Mon, 12 Mar 2007 11:17:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1863295</guid><dc:creator>martijnh1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/martijnh/rsscomments.aspx?WeblogPostID=1863295</wfw:commentRss><comments>http://blogs.msdn.com/b/martijnh/archive/2007/03/12/biztalk-server-pipeline-component-wizard-moved.aspx#comments</comments><description>As we are phasing out GotDotNet, projects need a new location to be hosted. I've moved the BizTalk Server Pipeline Component Wizard to it's new location. Please find it &lt;A class="" href="http://www.codeplex.com/btsplcw/" target=_blank mce_href="http://www.codeplex.com/btsplcw/"&gt;here&lt;/A&gt;.&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1863295" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/martijnh/archive/tags/BizTalk+Server/">BizTalk Server</category><category domain="http://blogs.msdn.com/b/martijnh/archive/tags/Pipeline+Component+Wizard/">Pipeline Component Wizard</category><category domain="http://blogs.msdn.com/b/martijnh/archive/tags/Pipeline/">Pipeline</category></item><item><title>CAB WPF XBAP implementation available (again)</title><link>http://blogs.msdn.com/b/martijnh/archive/2007/03/06/cab-wpf-xbap-implementation-available-again.aspx</link><pubDate>Tue, 06 Mar 2007 13:40:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1816123</guid><dc:creator>martijnh1</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/martijnh/rsscomments.aspx?WeblogPostID=1816123</wfw:commentRss><comments>http://blogs.msdn.com/b/martijnh/archive/2007/03/06/cab-wpf-xbap-implementation-available-again.aspx#comments</comments><description>&lt;P&gt;In the time to come, I'll be uploading packages available from my previous blog in the past because they got lost during my ISP transfer. First off, &lt;A class="" href="http://home.orange.nl/martijnhoogendoorn/CAB_WPF_XBAP.rar" mce_href="http://home.orange.nl/martijnhoogendoorn/CAB_WPF_XBAP.rar"&gt;here&lt;/A&gt;'s the &lt;A class="" href="http://msdn2.microsoft.com/en-us/library/aa480450.aspx" target=_blank mce_href="http://msdn2.microsoft.com/en-us/library/aa480450.aspx"&gt;CompositeUI Application Block&lt;/A&gt; &lt;A class="" href="http://msdn2.microsoft.com/en-us/library/aa970060.aspx" target=_blank mce_href="http://msdn2.microsoft.com/en-us/library/aa970060.aspx"&gt;XBAP&lt;/A&gt; &lt;A class="" href="http://wpf.netfx3.com/" target=_blank mce_href="http://wpf.netfx3.com/"&gt;WPF&lt;/A&gt; implementation, as I blogged about &lt;A class="" href="http://martijnh.blogspot.com/2006/10/supporting-wpf-xml-browser_116213875120852857.html" target=_blank mce_href="http://martijnh.blogspot.com/2006/10/supporting-wpf-xml-browser_116213875120852857.html"&gt;here&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;Please note the passwords for both protected signing keys are empty within the solution.&lt;/P&gt;
&lt;P&gt;This posting is provided "AS IS" with no warranties, and confers no rights.&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1816123" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/martijnh/archive/tags/WPF/">WPF</category><category domain="http://blogs.msdn.com/b/martijnh/archive/tags/Application+Block/">Application Block</category><category domain="http://blogs.msdn.com/b/martijnh/archive/tags/CAB/">CAB</category><category domain="http://blogs.msdn.com/b/martijnh/archive/tags/XBAP/">XBAP</category><category domain="http://blogs.msdn.com/b/martijnh/archive/tags/CompositeUI/">CompositeUI</category></item><item><title>Integration Masterclass Redelivery</title><link>http://blogs.msdn.com/b/martijnh/archive/2007/02/14/integration-masterclass-redelivery.aspx</link><pubDate>Wed, 14 Feb 2007 16:40:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1676367</guid><dc:creator>martijnh1</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/martijnh/rsscomments.aspx?WeblogPostID=1676367</wfw:commentRss><comments>http://blogs.msdn.com/b/martijnh/archive/2007/02/14/integration-masterclass-redelivery.aspx#comments</comments><description>&lt;SPAN style="FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman','serif'; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: NL; mso-fareast-language: NL; mso-bidi-language: AR-SA"&gt;
&lt;P class=MsoNormal style="MARGIN: 0cm 0cm 10pt"&gt;&lt;SPAN lang=EN-US style="mso-ansi-language: EN-US"&gt;&lt;FONT face=Calibri&gt;Microsoft Consulting Services in The Netherlands has developed a great integration masterclass, in which integration specialists compare Microsoft integration technologies and deliver real-world field experience in BizTalk Server implementations including best practices, tips and tricks. Check out the webpage at &lt;/FONT&gt;&lt;A href="http://www.microsoft.com/netherlands/evenementen/integration.aspx" mce_href="http://www.microsoft.com/netherlands/evenementen/integration.aspx"&gt;&lt;FONT face=Calibri&gt;http://www.microsoft.com/netherlands/evenementen/integration.aspx&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri&gt; for more information (Dutch content).&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1676367" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/b/martijnh/archive/tags/MCS/">MCS</category><category domain="http://blogs.msdn.com/b/martijnh/archive/tags/Integration/">Integration</category><category domain="http://blogs.msdn.com/b/martijnh/archive/tags/BizTalk+Server/">BizTalk Server</category></item><item><title>Ping!</title><link>http://blogs.msdn.com/b/martijnh/archive/2007/01/08/ping.aspx</link><pubDate>Mon, 08 Jan 2007 13:55:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1433578</guid><dc:creator>martijnh1</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/martijnh/rsscomments.aspx?WeblogPostID=1433578</wfw:commentRss><comments>http://blogs.msdn.com/b/martijnh/archive/2007/01/08/ping.aspx#comments</comments><description>Welcome to my blog. My name is Martijn Hoogendoorn, I work for the Dutch Services dvision of Microsoft and will be posting my technical adventures on here. I've been blogging for some time now; previous posts can be found &lt;A class="" href="http://martijnh.blogspot.com/" mce_href="http://martijnh.blogspot.com/"&gt;here&lt;/A&gt; (archive only).&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1433578" width="1" height="1"&gt;</description></item></channel></rss>