<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Middleware stories</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/aszego/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/aszego/feed.xml</link>
    <description>Random problems &amp;amp; solutions covering Microsoft&amp;#039;s distributed technologies</description>
    <lastBuildDate>Tue, 16 Apr 2019 04:43:52 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>UsernameToken Profile vs. WCF</title>
      <link>https://docs.microsoft.com/archive/blogs/aszego/usernametoken-profile-vs-wcf</link>
      <pubDate>Thu, 24 Jun 2010 03:16:00 GMT</pubDate>
      <dc:creator><![CDATA[Akos]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/aszego/2010/06/24/usernametoken-profile-vs-wcf/</guid>
      <description><![CDATA[The WS-Security UsernameToken Profile 1.0 defines how the username and password can be encapsulated...]]></description>
      <content:encoded><![CDATA[<p class="MsoNormal"><span style="font-family: Calibri; font-size: small;">The </span><a href="https://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0.pdf"><span style="font-family: Calibri; font-size: small;">WS-Security UsernameToken Profile 1.0</span></a><span style="font-family: Calibri;"><span style="font-size: small;"> defines how the username and password can be encapsulated into a security token.<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-family: Calibri;"><span style="font-size: small;">The profile defines two different ways to transmit the password (or password equivalent):<o:p></o:p></span></span></p>
<p class="MsoListParagraphCxSpFirst"><span style="font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;"><span style="mso-list: Ignore;"><span style="font-size: small;">&middot;</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-family: Calibri;"><span style="font-size: small;"><span class="id2673">wsse:PasswordText</span>: the password is sent in clear-text<o:p></o:p></span></span></p>
<p class="MsoListParagraphCxSpLast"><span style="font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;"><span style="mso-list: Ignore;"><span style="font-size: small;">&middot;</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: small;"><span style="font-family: Calibri;">wsse:PasswordDigest: a digest derived from the password is sent<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-family: Calibri; font-size: small;">As </span><a href="https://msdn.microsoft.com/en-us/library/aa738565.aspx"><span style="font-family: Calibri; font-size: small;">documented</span></a><span style="font-size: small;"><span style="font-family: Calibri;"> on MSDN<span style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri;">, only the first option is supported by WCF&rsquo;s built-in UsernameToken. This token is used in scenarios where client credential is set to Username.<o:p></o:p></span></span></span></p>
<p class="MsoNormal"><span style="font-size: small;"><span style="font-family: Calibri;">The second option, wsse:PasswordDigest, is the subject of this post.<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-size: small;"><span style="font-family: Calibri;">Besides WCF&rsquo;s predecessor &ndash; Web Services Enhancements &ndash;, other 3<sup>rd</sup>-party SOAP protocol stacks (e.g. Axis) support the digest version, too. This leads to interoperability problems with WCF, and we regularly get Support Requests from our customers to get help on this interoperability issue.<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-size: small;"><span style="font-family: Calibri;">Security tokens are most of the time not easy matter, but probably the UsernameToken is one of the simpler tokens. So after I began writing a custom token that supports the wsse:PasswordDigest, this indeed proved to be doable. <o:p></o:p></span></span></p>
<h2 style="margin: 10pt 0cm 0pt;"><span style="font-size: medium;"><span style="color: #e36c0a;"><span style="font-family: Cambria;">Usual Disclaimer<o:p></o:p></span></span></span></h2>
<p class="MsoNormal"><span style="font-size: small;"><span style="font-family: Calibri;">Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment. THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, provided that. You agree: (i)&nbsp;to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; (ii)&nbsp;to include a valid copyright notice on Your software product in which the Sample Code is embedded; and (iii)&nbsp;to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, including attorneys&rsquo; fees, that arise or result from the use or distribution of the Sample Code.<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-size: small;"><span style="font-family: Calibri;">You can download the sample from <a target="_blank" href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/10/02/95/13/UsernameTokenSample.zip" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Components-PostAttachments/00-10-02-95-13/UsernameTokenSample.zip" title="sample">here</a>.<o:p></o:p></span></span></p>
<h2 style="margin: 10pt 0cm 0pt;"><span class="id2673"><span style="font-size: medium;"><span style="color: #e36c0a;"><span style="font-family: Cambria;">Layout of the custom UsernameToken<o:p></o:p></span></span></span></span></h2>
<p class="MsoNormal"><span class="id2673"><span style="font-size: small;"><span style="font-family: Calibri;">The custom token builds on the CustomToken sample in the Windows SDK&rsquo;s WCF Samples section. This lays out the skeleton of a custom token by implementing a simple credit card token. Actually, the MSDN documentation for WCF security classes often showcases parts from this credit card sample, where applicable.<o:p></o:p></span></span></span></p>
<p class="MsoNormal"><span class="id2673"><span style="font-size: small;"><span style="font-family: Calibri;">Like this stock sample, our UsernameToken token won&rsquo;t support most of the advanced concepts, simply because they are not possible with this type of token. One of such would be, for example, to use this token for encryption.<o:p></o:p></span></span></span></p>
<p class="MsoNormal"><span class="id2673"><span style="font-size: small;"><span style="font-family: Calibri;">This also means that the implementation&rsquo;s most interesting part is generating the password digest. The rest of the code is plumbing that makes integration with WCF seamless.<o:p></o:p></span></span></span></p>
<p class="MsoNormal"><span class="id2673"><span style="font-size: small;"><span style="font-family: Calibri;">The sample Visual Studio 2010 solution consists of 5 projects:<o:p></o:p></span></span></span></p>
<table cellpadding="0" cellspacing="0" border="1" class="MsoTableLightShading" style="border-collapse: collapse; mso-border-top-alt: solid black 1.0pt; mso-border-top-themecolor: text1; mso-border-bottom-alt: solid black 1.0pt; mso-border-bottom-themecolor: text1; mso-yfti-tbllook: 1024; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt;">
<tbody>
<tr style="mso-yfti-irow: 0; mso-yfti-firstrow: yes;">
<td valign="top" style="border-bottom: #f0f0f0; border-left: #f0f0f0; padding-bottom: 0cm; padding-left: 5.4pt; padding-right: 5.4pt; background: silver; border-top: black 1pt solid; border-right: #f0f0f0; padding-top: 0cm; mso-border-top-themecolor: text1; mso-background-themecolor: text1; mso-background-themetint: 63;">
<p class="MsoNormal"><span class="id2673"><span style="color: black; mso-themecolor: text1; mso-themeshade: 191;"><span style="font-size: small;"><span style="font-family: Calibri;">Client<o:p></o:p></span></span></span></span></p>
</td>
<td valign="top" style="border-bottom: #f0f0f0; border-left: #f0f0f0; padding-bottom: 0cm; padding-left: 5.4pt; padding-right: 5.4pt; background: silver; border-top: black 1pt solid; border-right: #f0f0f0; padding-top: 0cm; mso-border-top-themecolor: text1; mso-background-themecolor: text1; mso-background-themetint: 63;">
<p class="MsoNormal"><span class="id2673"><span style="color: black; mso-themecolor: text1; mso-themeshade: 191;"><span style="font-size: small;"><span style="font-family: Calibri;">Sample client using the new token<o:p></o:p></span></span></span></span></p>
</td>
</tr>
<tr style="mso-yfti-irow: 1;">
<td valign="top" style="padding-bottom: 0cm; background-color: transparent; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0cm; border: #f0f0f0;">
<p class="MsoNormal"><span class="id2673"><span style="color: black; mso-themecolor: text1; mso-themeshade: 191;"><span style="font-size: small;"><span style="font-family: Calibri;">Common<o:p></o:p></span></span></span></span></p>
</td>
<td valign="top" style="padding-bottom: 0cm; background-color: transparent; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0cm; border: #f0f0f0;">
<p class="MsoNormal"><span class="id2673"><span style="color: black; mso-themecolor: text1; mso-themeshade: 191;"><span style="font-size: small;"><span style="font-family: Calibri;">A few common types that client and service share<o:p></o:p></span></span></span></span></p>
</td>
</tr>
<tr style="mso-yfti-irow: 2;">
<td valign="top" style="padding-bottom: 0cm; padding-left: 5.4pt; padding-right: 5.4pt; background: silver; padding-top: 0cm; mso-background-themecolor: text1; mso-background-themetint: 63; border: #f0f0f0;">
<p class="MsoNormal"><span class="id2673"><span style="color: black; mso-themecolor: text1; mso-themeshade: 191;"><span style="font-size: small;"><span style="font-family: Calibri;">Service<o:p></o:p></span></span></span></span></p>
</td>
<td valign="top" style="padding-bottom: 0cm; padding-left: 5.4pt; padding-right: 5.4pt; background: silver; padding-top: 0cm; mso-background-themecolor: text1; mso-background-themetint: 63; border: #f0f0f0;">
<p class="MsoNormal"><span class="id2673"><span style="color: black; mso-themecolor: text1; mso-themeshade: 191;"><span style="font-size: small;"><span style="font-family: Calibri;">Sample IIS-hosted service using the new token<o:p></o:p></span></span></span></span></p>
</td>
</tr>
<tr style="mso-yfti-irow: 3;">
<td valign="top" style="padding-bottom: 0cm; background-color: transparent; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0cm; border: #f0f0f0;">
<p class="MsoNormal"><span class="id2673"><span style="color: black; mso-themecolor: text1; mso-themeshade: 191;"><span style="font-size: small;"><span style="font-family: Calibri;">UsernameToken<o:p></o:p></span></span></span></span></p>
</td>
<td valign="top" style="padding-bottom: 0cm; background-color: transparent; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0cm; border: #f0f0f0;">
<p class="MsoNormal"><span class="id2673"><span style="color: black; mso-themecolor: text1; mso-themeshade: 191;"><span style="font-size: small;"><span style="font-family: Calibri;">The new token&rsquo;s implementation<o:p></o:p></span></span></span></span></p>
</td>
</tr>
<tr style="mso-yfti-irow: 4; mso-yfti-lastrow: yes;">
<td valign="top" style="border-bottom: black 1pt solid; border-left: #f0f0f0; padding-bottom: 0cm; padding-left: 5.4pt; padding-right: 5.4pt; background: silver; border-top: #f0f0f0; border-right: #f0f0f0; padding-top: 0cm; mso-border-bottom-themecolor: text1; mso-background-themecolor: text1; mso-background-themetint: 63;">
<p class="MsoNormal"><span class="id2673"><span style="color: black; mso-themecolor: text1; mso-themeshade: 191;"><span style="font-size: small;"><span style="font-family: Calibri;">Wse3InteropTest<o:p></o:p></span></span></span></span></p>
</td>
<td valign="top" style="border-bottom: black 1pt solid; border-left: #f0f0f0; padding-bottom: 0cm; padding-left: 5.4pt; padding-right: 5.4pt; background: silver; border-top: #f0f0f0; border-right: #f0f0f0; padding-top: 0cm; mso-border-bottom-themecolor: text1; mso-background-themecolor: text1; mso-background-themetint: 63;">
<p class="MsoNormal"><span class="id2673"><span style="color: black; mso-themecolor: text1; mso-themeshade: 191;"><span style="font-size: small;"><span style="font-family: Calibri;">A test project that demonstrates WSE3 interoperability on token-level<o:p></o:p></span></span></span></span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal"><span class="id2673"><br /><span style="font-size: small;"><span style="font-family: Calibri;">Here&rsquo;s a list of the most important classes and their role.<o:p></o:p></span></span></span></p>
<table cellpadding="0" cellspacing="0" border="1" class="MsoTableLightShading" style="border-collapse: collapse; mso-border-top-alt: solid black 1.0pt; mso-border-top-themecolor: text1; mso-border-bottom-alt: solid black 1.0pt; mso-border-bottom-themecolor: text1; mso-yfti-tbllook: 1024; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt;">
<tbody>
<tr style="mso-yfti-irow: 0; mso-yfti-firstrow: yes;">
<td valign="top" style="border-bottom: #f0f0f0; border-left: #f0f0f0; padding-bottom: 0cm; padding-left: 5.4pt; padding-right: 5.4pt; background: silver; border-top: black 1pt solid; border-right: #f0f0f0; padding-top: 0cm; mso-border-top-themecolor: text1; mso-background-themecolor: text1; mso-background-themetint: 63;">
<p class="MsoNormal"><span class="id2673"><span style="color: black; mso-themecolor: text1; mso-themeshade: 191;"><span style="font-size: small;"><span style="font-family: Calibri;">UsernameClientCredentials<o:p></o:p></span></span></span></span></p>
</td>
<td valign="top" style="border-bottom: #f0f0f0; border-left: #f0f0f0; padding-bottom: 0cm; padding-left: 5.4pt; padding-right: 5.4pt; background: silver; border-top: black 1pt solid; border-right: #f0f0f0; padding-top: 0cm; mso-border-top-themecolor: text1; mso-background-themecolor: text1; mso-background-themetint: 63;">
<p class="MsoNormal"><span class="id2673"><span style="color: black; mso-themecolor: text1; mso-themeshade: 191;"><span style="font-size: small;"><span style="font-family: Calibri;">Allows using the new token by providing username and password to the client<o:p></o:p></span></span></span></span></p>
</td>
</tr>
<tr style="mso-yfti-irow: 1;">
<td valign="top" style="padding-bottom: 0cm; background-color: transparent; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0cm; border: #f0f0f0;">
<p class="MsoNormal"><span class="id2673"><span style="color: black; mso-themecolor: text1; mso-themeshade: 191;"><span style="font-size: small;"><span style="font-family: Calibri;">UsernameClientCredentialsSecurityTokenManager<o:p></o:p></span></span></span></span></p>
</td>
<td valign="top" style="padding-bottom: 0cm; background-color: transparent; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0cm; border: #f0f0f0;">
<p class="MsoNormal"><span class="id2673"><span style="color: black; mso-themecolor: text1; mso-themeshade: 191;"><span style="font-size: small;"><span style="font-family: Calibri;">Manages the new tokens on client-side<o:p></o:p></span></span></span></span></p>
</td>
</tr>
<tr style="mso-yfti-irow: 2;">
<td valign="top" style="padding-bottom: 0cm; padding-left: 5.4pt; padding-right: 5.4pt; background: silver; padding-top: 0cm; mso-background-themecolor: text1; mso-background-themetint: 63; border: #f0f0f0;">
<p class="MsoNormal"><span class="id2673"><span style="color: black; mso-themecolor: text1; mso-themeshade: 191;"><span style="font-size: small;"><span style="font-family: Calibri;">UsernameInfo<o:p></o:p></span></span></span></span></p>
</td>
<td valign="top" style="padding-bottom: 0cm; padding-left: 5.4pt; padding-right: 5.4pt; background: silver; padding-top: 0cm; mso-background-themecolor: text1; mso-background-themetint: 63; border: #f0f0f0;">
<p class="MsoNormal"><span class="id2673"><span style="color: black; mso-themecolor: text1; mso-themeshade: 191;"><span style="font-size: small;"><span style="font-family: Calibri;">Simply holds username and password<o:p></o:p></span></span></span></span></p>
</td>
</tr>
<tr style="mso-yfti-irow: 3;">
<td valign="top" style="padding-bottom: 0cm; background-color: transparent; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0cm; border: #f0f0f0;">
<p class="MsoNormal"><span class="id2673"><span style="color: black; mso-themecolor: text1; mso-themeshade: 191;"><span style="font-size: small;"><span style="font-family: Calibri;">UsernamePasswordProvider<o:p></o:p></span></span></span></span></p>
</td>
<td valign="top" style="padding-bottom: 0cm; background-color: transparent; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0cm; border: #f0f0f0;">
<p class="MsoNormal"><span class="id2673"><span style="color: black; mso-themecolor: text1; mso-themeshade: 191;"><span style="font-size: small;"><span style="font-family: Calibri;">Retrieves password for a given username at the service side for validation<o:p></o:p></span></span></span></span></p>
</td>
</tr>
<tr style="mso-yfti-irow: 4;">
<td valign="top" style="padding-bottom: 0cm; padding-left: 5.4pt; padding-right: 5.4pt; background: silver; padding-top: 0cm; mso-background-themecolor: text1; mso-background-themetint: 63; border: #f0f0f0;">
<p class="MsoNormal"><span style="color: black; mso-themecolor: text1; mso-themeshade: 191;"><span style="font-size: small;"><span style="font-family: Calibri;">UsernameSecurityTokenSerializer<span class="id2673"><o:p></o:p></span></span></span></span></p>
</td>
<td valign="top" style="padding-bottom: 0cm; padding-left: 5.4pt; padding-right: 5.4pt; background: silver; padding-top: 0cm; mso-background-themecolor: text1; mso-background-themetint: 63; border: #f0f0f0;">
<p class="MsoNormal"><span class="id2673"><span style="color: black; mso-themecolor: text1; mso-themeshade: 191;"><span style="font-size: small;"><span style="font-family: Calibri;">Serializes and deserializes the token<o:p></o:p></span></span></span></span></p>
</td>
</tr>
<tr style="mso-yfti-irow: 5;">
<td valign="top" style="padding-bottom: 0cm; background-color: transparent; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0cm; border: #f0f0f0;">
<p class="MsoNormal"><span class="id2673"><span style="color: black; mso-themecolor: text1; mso-themeshade: 191;"><span style="font-size: small;"><span style="font-family: Calibri;">UsernameServiceCredentials<o:p></o:p></span></span></span></span></p>
</td>
<td valign="top" style="padding-bottom: 0cm; background-color: transparent; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0cm; border: #f0f0f0;">
<p class="MsoNormal"><span class="id2673"><span style="color: black; mso-themecolor: text1; mso-themeshade: 191;"><span style="font-size: small;"><span style="font-family: Calibri;">Allows using the new token on service-side<o:p></o:p></span></span></span></span></p>
</td>
</tr>
<tr style="mso-yfti-irow: 6;">
<td valign="top" style="padding-bottom: 0cm; padding-left: 5.4pt; padding-right: 5.4pt; background: silver; padding-top: 0cm; mso-background-themecolor: text1; mso-background-themetint: 63; border: #f0f0f0;">
<p class="MsoNormal"><span style="color: black; mso-themecolor: text1; mso-themeshade: 191;"><span style="font-size: small;"><span style="font-family: Calibri;">UsernameToken<span class="id2673"><o:p></o:p></span></span></span></span></p>
</td>
<td valign="top" style="padding-bottom: 0cm; padding-left: 5.4pt; padding-right: 5.4pt; background: silver; padding-top: 0cm; mso-background-themecolor: text1; mso-background-themetint: 63; border: #f0f0f0;">
<p class="MsoNormal"><span class="id2673"><span style="color: black; mso-themecolor: text1; mso-themeshade: 191;"><span style="font-size: small;"><span style="font-family: Calibri;">Core token class dealing with cryptography<o:p></o:p></span></span></span></span></p>
</td>
</tr>
<tr style="mso-yfti-irow: 7;">
<td valign="top" style="padding-bottom: 0cm; background-color: transparent; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0cm; border: #f0f0f0;">
<p class="MsoNormal"><span style="color: black; mso-themecolor: text1; mso-themeshade: 191;"><span style="font-size: small;"><span style="font-family: Calibri;">UsernameTokenAuthenticator<o:p></o:p></span></span></span></p>
</td>
<td valign="top" style="padding-bottom: 0cm; background-color: transparent; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0cm; border: #f0f0f0;">
<p class="MsoNormal"><span class="id2673"><span style="color: black; mso-themecolor: text1; mso-themeshade: 191;"><span style="font-size: small;"><span style="font-family: Calibri;">Authenticates the new tokens<o:p></o:p></span></span></span></span></p>
</td>
</tr>
<tr style="mso-yfti-irow: 8;">
<td valign="top" style="padding-bottom: 0cm; padding-left: 5.4pt; padding-right: 5.4pt; background: silver; padding-top: 0cm; mso-background-themecolor: text1; mso-background-themetint: 63; border: #f0f0f0;">
<p class="MsoNormal"><span style="color: black; mso-themecolor: text1; mso-themeshade: 191;"><span style="font-size: small;"><span style="font-family: Calibri;">UserNameTokenAuthorizationPolicy<o:p></o:p></span></span></span></p>
</td>
<td valign="top" style="padding-bottom: 0cm; padding-left: 5.4pt; padding-right: 5.4pt; background: silver; padding-top: 0cm; mso-background-themecolor: text1; mso-background-themetint: 63; border: #f0f0f0;">
<p class="MsoNormal"><span class="id2673"><span style="color: black; mso-themecolor: text1; mso-themeshade: 191;"><span style="font-size: small;"><span style="font-family: Calibri;">Issues claims on the new token<o:p></o:p></span></span></span></span></p>
</td>
</tr>
<tr style="mso-yfti-irow: 9;">
<td valign="top" style="padding-bottom: 0cm; background-color: transparent; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0cm; border: #f0f0f0;">
<p class="MsoNormal"><span style="color: black; mso-themecolor: text1; mso-themeshade: 191;"><span style="font-size: small;"><span style="font-family: Calibri;">UsernameTokenParameters<o:p></o:p></span></span></span></p>
</td>
<td valign="top" style="padding-bottom: 0cm; background-color: transparent; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0cm; border: #f0f0f0;">
<p class="MsoNormal"><span class="id2673"><span style="color: black; mso-themecolor: text1; mso-themeshade: 191;"><span style="font-size: small;"><span style="font-family: Calibri;">Describes the new token&rsquo;s capabilities<o:p></o:p></span></span></span></span></p>
</td>
</tr>
<tr style="mso-yfti-irow: 10; mso-yfti-lastrow: yes;">
<td valign="top" style="border-bottom: black 1pt solid; border-left: #f0f0f0; padding-bottom: 0cm; padding-left: 5.4pt; padding-right: 5.4pt; background: silver; border-top: #f0f0f0; border-right: #f0f0f0; padding-top: 0cm; mso-border-bottom-themecolor: text1; mso-background-themecolor: text1; mso-background-themetint: 63;">
<p class="MsoNormal"><span style="color: black; mso-themecolor: text1; mso-themeshade: 191;"><span style="font-size: small;"><span style="font-family: Calibri;">UsernameTokenProvider<o:p></o:p></span></span></span></p>
</td>
<td valign="top" style="border-bottom: black 1pt solid; border-left: #f0f0f0; padding-bottom: 0cm; padding-left: 5.4pt; padding-right: 5.4pt; background: silver; border-top: #f0f0f0; border-right: #f0f0f0; padding-top: 0cm; mso-border-bottom-themecolor: text1; mso-background-themecolor: text1; mso-background-themetint: 63;">
<p class="MsoNormal"><span class="id2673"><span style="color: black; mso-themecolor: text1; mso-themeshade: 191;"><span style="font-size: small;"><span style="font-family: Calibri;">Creates the new token<o:p></o:p></span></span></span></span></p>
</td>
</tr>
</tbody>
</table>
<h2 style="margin: 10pt 0cm 0pt;"><span class="id2673"><span style="font-size: medium;"><span style="color: #e36c0a;"><span style="font-family: Cambria;">UsernameToken class at the core<o:p></o:p></span></span></span></span></h2>
<p class="MsoNormal"><span class="id2673"><span style="font-family: Calibri;"><span style="font-size: small;">This central type deals with cryptography to produce the password digest according to the requirements of the WS-S UsernameToken Profile:<o:p></o:p></span></span></span></p>
<p class="MsoNormal" align="center"><span class="id2673"><span style="font-family: 'Courier New';"><span style="font-size: small;">Password_Digest = Base64 ( SHA-1 ( nonce + created + password ) )<o:p></o:p></span></span></span></p>
<p class="MsoNormal"><span style="font-family: Calibri; font-size: small;">This is done in </span><span style="line-height: 115%; font-family: Consolas; font-size: 9.5pt;">GetPasswordDigestAsBase64</span><span style="font-family: Calibri;"><span style="font-size: small;"> as follows:<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-family: 'Courier New';"><span style="font-size: small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: blue;">public</span> <span style="color: blue;">string</span> GetPasswordDigestAsBase64()<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-family: 'Courier New';"><span style="font-size: small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>{<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-family: 'Courier New';"><span style="font-size: small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: green;">// generate a cryptographically strong random value</span><o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-family: 'Courier New';"><span style="font-size: small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #2b91af;">RandomNumberGenerator</span> rndGenerator <span style="color: maroon;">=</span> <span style="color: blue;">new</span> <span style="color: #2b91af;">RNGCryptoServiceProvider</span>();<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-family: 'Courier New';"><span style="font-size: small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>rndGenerator<span style="color: maroon;">.</span>GetBytes(_nonce);<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-family: 'Courier New';"><o:p><span style="font-size: small;">&nbsp;</span></o:p></span></p>
<p class="MsoNormal"><span style="font-family: 'Courier New';"><span style="font-size: small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: green;">// get other operands to the right format</span><o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-family: 'Courier New';"><span style="font-size: small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: blue;">byte</span>[] time <span style="color: maroon;">=</span> <span style="color: #2b91af;">Encoding</span><span style="color: maroon;">.</span>UTF8<span style="color: maroon;">.</span>GetBytes(GetCreatedAsString());<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-family: 'Courier New';"><span style="font-size: small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: blue;">byte</span>[] pwd <span style="color: maroon;">=</span> <span style="color: #2b91af;">Encoding</span><span style="color: maroon;">.</span>UTF8<span style="color: maroon;">.</span>GetBytes(_usernameInfo<span style="color: maroon;">.</span>Password);<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-family: 'Courier New';"><span style="font-size: small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: blue;">byte</span>[] operand <span style="color: maroon;">=</span> <span style="color: blue;">new</span> <span style="color: blue;">byte</span>[_nonce<span style="color: maroon;">.</span>Length <span style="color: maroon;">+</span> time<span style="color: maroon;">.</span>Length <span style="color: maroon;">+</span> pwd<span style="color: maroon;">.</span>Length];<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-family: 'Courier New';"><span style="font-size: small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #2b91af;">Array</span><span style="color: maroon;">.</span>Copy(_nonce, operand, _nonce<span style="color: maroon;">.</span>Length);<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-family: 'Courier New';"><span style="font-size: small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #2b91af;">Array</span><span style="color: maroon;">.</span>Copy(time, <span style="color: green;">0</span>, operand, _nonce<span style="color: maroon;">.</span>Length, time<span style="color: maroon;">.</span>Length);<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-family: 'Courier New';"><span style="font-size: small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #2b91af;">Array</span><span style="color: maroon;">.</span>Copy(pwd, <span style="color: green;">0</span>, operand, _nonce<span style="color: maroon;">.</span>Length <span style="color: maroon;">+</span> time<span style="color: maroon;">.</span>Length, pwd<span style="color: maroon;">.</span>Length);<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-family: 'Courier New';"><span style="font-size: small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-family: 'Courier New';"><span style="font-size: small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: green;">// create the hash</span><o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-family: 'Courier New';"><span style="font-size: small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #2b91af;">SHA1</span> sha1 <span style="color: maroon;">=</span> <span style="color: #2b91af;">SHA1</span><span style="color: maroon;">.</span>Create();<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-family: 'Courier New';"><span style="font-size: small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: blue;">return</span> <span style="color: #2b91af;">Convert</span><span style="color: maroon;">.</span>ToBase64String(sha1<span style="color: maroon;">.</span>ComputeHash(operand));<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-family: 'Courier New';"><span style="font-size: small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}<o:p></o:p></span></span></p>
<p class="MsoNormal"><o:p><span style="font-family: Calibri; font-size: small;">&nbsp;</span></o:p></p>
<p class="MsoNormal"><span style="font-size: small;"><span style="font-family: Calibri;">Fortunately, this isn&rsquo;t too complicated thanks to the rich .NET class library available to us:<o:p></o:p></span></span></p>
<p class="MsoListParagraphCxSpFirst"><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"><span style="font-family: Calibri; font-size: small;">1.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: small;"><span style="font-family: Calibri;">Create a cryptographically strong random value, which will be the nonce. This can be used to provide defense against replay-attacks with the combination of a nonce-cache in the service (not part of the sampe).<o:p></o:p></span></span></p>
<p class="MsoListParagraphCxSpMiddle"><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"><span style="font-family: Calibri; font-size: small;">2.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: small;"><span style="font-family: Calibri;">Take the time the token was created at, and transform it to yyyy-MM-ddTHH:mm:ssZ format. Encode it in UTF8 byte array.<br />Note that knowing the time is useful if we don&rsquo;t want the service&rsquo;s nonce-cache grow unlimited.<o:p></o:p></span></span></p>
<p class="MsoListParagraphCxSpMiddle"><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"><span style="font-family: Calibri; font-size: small;">3.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: small;"><span style="font-family: Calibri;">Encode in a UTF8 byte array.<o:p></o:p></span></span></p>
<p class="MsoListParagraphCxSpMiddle"><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"><span style="font-family: Calibri; font-size: small;">4.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: small;"><span style="font-family: Calibri;">Allocate a byte array large enough to hold all of this data, and concatenate them.<o:p></o:p></span></span></p>
<p class="MsoListParagraphCxSpMiddle"><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"><span style="font-family: Calibri; font-size: small;">5.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-size: small;"><span style="font-family: Calibri;">Create the SHA-1 hash.<o:p></o:p></span></span></p>
<p class="MsoListParagraphCxSpLast"><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"><span style="font-family: Calibri; font-size: small;">6.</span><span style="font: 7pt 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="font-family: Calibri;"><span style="font-size: small;">Return the base64 representation.<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-family: Calibri;"><span style="font-size: small;">Validating an incoming token takes simply re-building the hash from the password associated with the username (service must know this), and the time and nonce already stored in the incoming token:<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-family: 'Courier New';"><span style="font-size: small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: blue;">public</span> <span style="color: blue;">bool</span> ValidateToken(<span style="color: blue;">string</span> password)<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-family: 'Courier New';"><span style="font-size: small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>{<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-family: 'Courier New';"><span style="font-size: small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: blue;">byte</span>[] pwd <span style="color: maroon;">=</span> <span style="color: #2b91af;">Encoding</span><span style="color: maroon;">.</span>UTF8<span style="color: maroon;">.</span>GetBytes(password);<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-family: 'Courier New';"><span style="font-size: small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: blue;">byte</span>[] createdBytes <span style="color: maroon;">=</span> <span style="color: #2b91af;">Encoding</span><span style="color: maroon;">.</span>UTF8<span style="color: maroon;">.</span>GetBytes(GetCreatedAsString());<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-family: 'Courier New';"><span style="font-size: small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: blue;">byte</span>[] operand <span style="color: maroon;">=</span> <span style="color: blue;">new</span> <span style="color: blue;">byte</span>[_nonce<span style="color: maroon;">.</span>Length <span style="color: maroon;">+</span> createdBytes<span style="color: maroon;">.</span>Length <span style="color: maroon;">+</span> pwd<span style="color: maroon;">.</span>Length];<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-family: 'Courier New';"><span style="font-size: small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #2b91af;">Array</span><span style="color: maroon;">.</span>Copy(_nonce, operand, _nonce<span style="color: maroon;">.</span>Length);<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-family: 'Courier New';"><span style="font-size: small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #2b91af;">Array</span><span style="color: maroon;">.</span>Copy(createdBytes, <span style="color: green;">0</span>, operand, _nonce<span style="color: maroon;">.</span>Length, createdBytes<span style="color: maroon;">.</span>Length);<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-family: 'Courier New';"><span style="font-size: small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #2b91af;">Array</span><span style="color: maroon;">.</span>Copy(pwd, <span style="color: green;">0</span>, operand, _nonce<span style="color: maroon;">.</span>Length <span style="color: maroon;">+</span> createdBytes<span style="color: maroon;">.</span>Length, pwd<span style="color: maroon;">.</span>Length);<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-family: 'Courier New';"><span style="font-size: small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #2b91af;">SHA1</span> sha1 <span style="color: maroon;">=</span> <span style="color: #2b91af;">SHA1</span><span style="color: maroon;">.</span>Create();<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-family: 'Courier New';"><span style="font-size: small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: blue;">string</span> trueDigest <span style="color: maroon;">=</span> <span style="color: #2b91af;">Convert</span><span style="color: maroon;">.</span>ToBase64String(sha1<span style="color: maroon;">.</span>ComputeHash(operand));<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-family: 'Courier New';"><o:p><span style="font-size: small;">&nbsp;</span></o:p></span></p>
<p class="MsoNormal"><span style="font-family: 'Courier New';"><span style="font-size: small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: blue;">return</span> <span style="color: #2b91af;">String</span><span style="color: maroon;">.</span>Compare(trueDigest, _usernameInfo<span style="color: maroon;">.</span>Password) <span style="color: maroon;">==</span> <span style="color: green;">0</span>;<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-family: 'Courier New';"><span style="font-size: small;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}<o:p></o:p></span></span></p>
<p class="MsoNormal"><o:p><span style="font-family: Calibri; font-size: small;">&nbsp;</span></o:p></p>
<h2 style="margin: 10pt 0cm 0pt;"><span class="id2673"><span style="font-size: medium;"><span style="color: #e36c0a;"><span style="font-family: Cambria;">Deployment<o:p></o:p></span></span></span></span></h2>
<p class="MsoNormal"><span style="font-size: small;"><span style="font-family: Calibri;">To test the sample, build it with Visual Studio 2010 (please ignore source control warnings, this solutio.n is part of a Team Foundation Server project), and create a virtual application on local IIS that points to the service. The client is configured to use https://localhost/servicemodelsamples/service.svc.<o:p></o:p></span></span></p>
<h2 style="margin: 10pt 0cm 0pt;"><span class="id2673"><span style="font-size: medium;"><span style="color: #e36c0a;"><span style="font-family: Cambria;">Interoperability with Axis<o:p></o:p></span></span></span></span></h2>
<p class="MsoNormal"><span class="id2673"><span style="font-size: small;"><span style="font-family: Calibri;">In the actual scenario I wrote this custom token for, the Java-based service didn&rsquo;t like the addressing headers that WCF generated. In particular, the wsa:Action header had mustUnderstand set to true, and we got the error message that &ldquo;Must Understand check failed for header https://www.w3.org/2005/08/addressing : Action&rdquo;.<o:p></o:p></span></span></span></p>
<p class="MsoNormal"><span class="id2673"><span style="font-size: small;"><span style="font-family: Calibri;">WCF doesn&rsquo;t allow removing mustUnderstand from the addressing headers (unless you remove it from the serialized message). Therefore, in the sample I simply ask WCF to not add the addressing headers by setting MessageVersion to Soap11.<o:p></o:p></span></span></span></p>
<h2 style="margin: 10pt 0cm 0pt;"><span class="id2673"><span style="font-size: medium;"><span style="color: #e36c0a;"><span style="font-family: Cambria;">Security note<o:p></o:p></span></span></span></span></h2>
<p class="MsoNormal"><span class="id2673"><span style="font-size: small;"><span style="font-family: Calibri;">WS-S UsernameToken Profile 1.0 warns that digested password should be sent over secure transport.<o:p></o:p></span></span></span></p>
<p class="MsoNormal"><span class="id2673"><span style="font-family: Calibri; font-size: small;">Obviously, using an unsecure transport doesn&rsquo;t protect against capturing or modifying the message payload, but I&rsquo;m not sure why the password would not be protected against attacks. Anyway, I&rsquo;m not a security expert, so I advise following the recommendation and use a secure transport.</span></span></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/10/02/95/13/UsernameTokenSample.zip" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-10-02-95-13/UsernameTokenSample.zip">UsernameTokenSample.zip</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Override AtlThrow with care</title>
      <link>https://docs.microsoft.com/archive/blogs/aszego/override-atlthrow-with-care</link>
      <pubDate>Wed, 12 May 2010 06:24:00 GMT</pubDate>
      <dc:creator><![CDATA[Akos]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/aszego/2010/05/12/override-atlthrow-with-care/</guid>
      <description><![CDATA[ATL allows you to replace its stock routine, AtlThrow, for communicating an error back to the...]]></description>
      <content:encoded><![CDATA[<FONT size=3><FONT face=Calibri>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal>ATL allows you to replace its stock routine, AtlThrow, for communicating an error back to the caller using exceptions. This is documented on MSDN here: <A href="https://msdn.microsoft.com/en-us/library/z325eyx0.aspx" mce_href="https://msdn.microsoft.com/en-us/library/z325eyx0.aspx">https://msdn.microsoft.com/en-us/library/z325eyx0.aspx</A>.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal>Most of the time, when ATL encounters an error and you overrode AtlThrow with a custom implementation, the latter will be called (as expected). However, a customer reported that under certain circumstances, the stock implementation will be called, no matter what other implementation you supplied.<o:p></o:p></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal>While this issue is certainly caused by ATL’s current design, it’s very interesting to look behind the curtains.<o:p></o:p></P>
<H2 style="MARGIN: 10pt 0cm 0pt"><FONT size=4><FONT color=#e36c0a><FONT face=Cambria>How ATL implements this<o:p></o:p></FONT></FONT></FONT></H2>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal>ATL is shipped with source code, so we can easily check how it’s done.<o:p></o:p></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal>Essentially, AtlThrow is a preprocessor symbol, defined in atldef.h:<o:p></o:p></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt">#define</SPAN><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"> AtlThrow ATL<SPAN style="COLOR: maroon">::</SPAN>AtlThrowImpl<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal>If you define _ATL_CUSTOM_THROW and your own AtlThrow, then this stock definition will not be processed thanks to an <SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt">#ifdef</SPAN>.<BR>In ATL code, when an error is detected, AtlThow is “called” instead of ATL::AtlThrowImpl. That way, if you define both _ATL_CUSTOM_THROW and AtlThrow, the pre-processor resolves AtlThrow to your symbol, and thus your function gets called.<o:p></o:p></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal>This solution has an important requirement though. Since the pre-processor runs only at compile-time, your custom implementation will be used only if all callers are recompiled. How does ATL fulfill this? <o:p></o:p></P>
<P style="TEXT-INDENT: -18pt; MARGIN: 0cm 0cm 0pt 36pt; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpFirst><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore">1.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN>ATL source comprises many .h, .inl and .cpp files. When you add support for ATL to your project, you essentially include the core set of ATL header files and implicitly link to the static or the stub library (the latter is needed to use ATL in DLL).<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>Since many ATL functions are actually implemented inline in the header files, you actually compile these functions every time you build your applications (of course, performance will not suffer due to precompiled headers).<o:p></o:p></P>
<P style="TEXT-INDENT: -18pt; MARGIN: 0cm 0cm 10pt 36pt; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpLast><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore">2.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN>AtlThrow is called <B style="mso-bidi-font-weight: normal">solely</B> in .h and .inl files. It is not called in .cpp files that make up ATL.<o:p></o:p></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal>Therefore, the compiler will always produce a variant of the functions calling AtlThrow in the header files that calls your implementation. When calling functions defined originally in ATL .cpp files (which reside in the static library or dynamic DLL), which in turn call functions that may call AtlThrow, you still get the right behavior because the linker chooses the variant calling your implementation.<o:p></o:p></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal>However, this assumption turns out to be false. <o:p></o:p></P>
<H2 style="MARGIN: 10pt 0cm 0pt"><FONT size=4><FONT color=#e36c0a><FONT face=Cambria>Background<o:p></o:p></FONT></FONT></FONT></H2>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal>As Mike Marcelais, a colleague here at Microsoft explained to me, C++ has a rule called the ‘One Definition Rule’ (ODR). This basically says that even though you can declare something as many times as you want, you can only define it once.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>Of course, this applies to functions as well.<o:p></o:p></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal>Inline functions, to be useful, need to go in header files so that everyone can see them.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>Since the compiler can’t guarantee that it will always inline an inline function, the compiler also generates a non-inline version of each inline function.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>Since the function is defined in a header file, each .cpp file will have its own copy of the function.<o:p></o:p></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal>Since that basically violates the ODR to have multiple definitions of the inline function, the C++ standard created a special case for inline functions:<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>An inline function is allowed to be defined multiple times, as long as they are always the same.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>Since it is almost impossible for compilers to figure out when two functions are “the same”, compilers are not required to report errors in this case.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>Note that this is generally true for ODR violations – detecting them can be quite hard (or even impossible) so the standard generally doesn’t require that the compiler tools detect them and report them as errors.)<o:p></o:p></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal>In reality, if you have two different versions of the same inline function, then the linker will see both implementations when it creates the final binary. Normally, it would report an error (“multiply defined symbol”) but it notices that both functions were marked as inline, and therefore it assumes that they must be copies of the same function, and it picks one “at random” to use and throws the other copies away.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>This randomness could be a function of a few factors, e.g. switching from a debug to a release build. If the copies really were the same, it wouldn’t matter which one the linker uses.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>The result is that sometimes version A is used, but when you recompile, version B might be used.<o:p></o:p></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal>Of course, even if version A was selected by the linker, any places that could see version B and where the compiler decided to inline version B in the caller would still be using version B.<o:p></o:p></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal>You can provoke the unexpected behavior with the following code. Note that with Visual C++ 2010, debug build of this produces the unexpected behavior described above (ATL::AtlThrowImpl will be called), while the release build yields the intended one (MyThrowImpl will execute).<o:p></o:p></FONT></FONT></P>
<P style="LINE-HEIGHT: normal; BACKGROUND: #eeece1" class=MsoNormalCxSpMiddle><SPAN style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt">#define</SPAN><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"> _ATL_CUSTOM_THROW<BR></SPAN><SPAN style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt">#define</SPAN><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"> AtlThrow MyThrowImpl<BR></SPAN><SPAN style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt">void</SPAN><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"> <SPAN style="COLOR: blue">__stdcall</SPAN> MyThrowImpl<SPAN style="COLOR: maroon">(</SPAN><SPAN style="COLOR: blue">int</SPAN> i<SPAN style="COLOR: maroon">);<BR></SPAN></SPAN><SPAN style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt">#include</SPAN><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"> <SPAN style="COLOR: #a31515">&lt;stdio.h&gt;<BR></SPAN></SPAN><SPAN style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt">#include</SPAN><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"> <SPAN style="COLOR: #a31515">&lt;tchar.h&gt;<BR></SPAN></SPAN><SPAN style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt">#include</SPAN><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"> <SPAN style="COLOR: #a31515">&lt;atlbase.h&gt;<BR></SPAN></SPAN><SPAN style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt">#include</SPAN><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"> <SPAN style="COLOR: #a31515">&lt;atlstr.h&gt;<BR></SPAN></SPAN><SPAN style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt">#include</SPAN><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"> <SPAN style="COLOR: #a31515">&lt;atltime.h&gt;<BR><BR></SPAN></SPAN><SPAN style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt">int</SPAN><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"> _tmain<SPAN style="COLOR: maroon">(</SPAN><SPAN style="COLOR: blue">int</SPAN> argc<SPAN style="COLOR: maroon">,</SPAN> _TCHAR<SPAN style="COLOR: maroon">*</SPAN> argv<SPAN style="COLOR: maroon">[])<BR></SPAN></SPAN><SPAN style="FONT-FAMILY: Consolas; COLOR: maroon; FONT-SIZE: 9.5pt">{<BR></SPAN><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CTime time<SPAN style="COLOR: maroon">(</SPAN><SPAN style="COLOR: green">11111</SPAN><SPAN style="COLOR: maroon">,</SPAN> <SPAN style="COLOR: green">11</SPAN><SPAN style="COLOR: maroon">,</SPAN> <SPAN style="COLOR: green">10</SPAN><SPAN style="COLOR: maroon">,</SPAN> <SPAN style="COLOR: green">10</SPAN><SPAN style="COLOR: maroon">,</SPAN> <SPAN style="COLOR: green">10</SPAN><SPAN style="COLOR: maroon">,</SPAN> <SPAN style="COLOR: green">10</SPAN><SPAN style="COLOR: maroon">);<BR></SPAN></SPAN><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: blue">return</SPAN> <SPAN style="COLOR: green">0</SPAN><SPAN style="COLOR: maroon">;<BR></SPAN></SPAN><SPAN style="FONT-FAMILY: Consolas; COLOR: maroon; FONT-SIZE: 9.5pt">}<BR><BR></SPAN><SPAN style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt">void</SPAN><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"> <SPAN style="COLOR: blue">__stdcall</SPAN> MyThrowImpl<SPAN style="COLOR: maroon">(</SPAN><SPAN style="COLOR: blue">int</SPAN> i<SPAN style="COLOR: maroon">)<BR></SPAN></SPAN><SPAN style="FONT-FAMILY: Consolas; COLOR: maroon; FONT-SIZE: 9.5pt">{<BR></SPAN><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf<SPAN style="COLOR: maroon">(</SPAN><SPAN style="COLOR: #a31515">"MyThrowImpl"</SPAN><SPAN style="COLOR: maroon">);<BR></SPAN></SPAN><SPAN style="FONT-FAMILY: Consolas; COLOR: maroon; FONT-SIZE: 9.5pt">}</SPAN></P><SPAN style="FONT-FAMILY: Consolas; COLOR: maroon; FONT-SIZE: 9.5pt">
<H2 style="MARGIN: 10pt 0cm 0pt"><FONT size=4><FONT color=#e36c0a><FONT face=Cambria>Resolution<o:p></o:p></FONT></FONT></FONT></H2>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT size=3><FONT color=#000000><FONT face=Calibri>The ATL team is aware of this issue, so the design may be changed in the future (note that there’s no guarantee for this). <o:p></o:p></FONT></FONT></FONT></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT size=3><FONT color=#000000><FONT face=Calibri>We’ll definitely fix the documentation on MSDN, and in the meantime, you can get around this this by re-building ATL with your error handler. See readme.txt in C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\atlmfc\src\ for instructions on building ATL.</FONT></FONT></FONT></SPAN></P>]]></content:encoded>
    </item>
    <item>
      <title>WIF on Windows Server 2003</title>
      <link>https://docs.microsoft.com/archive/blogs/aszego/wif-on-windows-server-2003</link>
      <pubDate>Mon, 26 Apr 2010 02:54:00 GMT</pubDate>
      <dc:creator><![CDATA[Akos]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/aszego/2010/04/26/wif-on-windows-server-2003/</guid>
      <description><![CDATA[I was setting up Windows Identity Foundation (WIF, formerly known as Geneva) on Windows Server...]]></description>
      <content:encoded><![CDATA[<FONT size=3><FONT face=Calibri><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><SPAN style="mso-bidi-font-family: 'Segoe UI'">I was setting up Windows Identity Foundation (WIF, formerly known as Geneva) on Windows Server 2003 to reproduce a customer’s problem.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><SPAN style="mso-bidi-font-family: 'Segoe UI'">However, I got the following exception, even when trying one of the WIF SDK samples:<o:p></o:p></SPAN></P><A href="https://social.msdn.microsoft.com/Forums/en-US/Geneva/thread/35c10fe5-9693-4f3a-9c5c-8afbb423ee95?outputAs=rss" mce_href="https://social.msdn.microsoft.com/Forums/en-US/Geneva/thread/35c10fe5-9693-4f3a-9c5c-8afbb423ee95?outputAs=rss"><SPAN style="BORDER-BOTTOM: windowtext 1pt; BORDER-LEFT: windowtext 1pt; PADDING-BOTTOM: 0cm; PADDING-LEFT: 0cm; PADDING-RIGHT: 0cm; COLOR: #0066dd; BORDER-TOP: windowtext 1pt; BORDER-RIGHT: windowtext 1pt; TEXT-DECORATION: none; PADDING-TOP: 0cm; mso-bidi-font-family: 'Segoe UI'; mso-no-proof: yes; text-underline: none; mso-border-alt: none windowtext 0cm"><?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" /><v:shapetype id=_x0000_t75 coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"><v:stroke joinstyle="miter"></v:stroke><v:formulas><v:f eqn="if lineDrawn pixelLineWidth 0"></v:f><v:f eqn="sum @0 1 0"></v:f><v:f eqn="sum 0 0 @1"></v:f><v:f eqn="prod @2 1 2"></v:f><v:f eqn="prod @3 21600 pixelWidth"></v:f><v:f eqn="prod @3 21600 pixelHeight"></v:f><v:f eqn="sum @0 0 1"></v:f><v:f eqn="prod @6 1 2"></v:f><v:f eqn="prod @7 21600 pixelWidth"></v:f><v:f eqn="sum @8 21600 0"></v:f><v:f eqn="prod @7 21600 pixelHeight"></v:f><v:f eqn="sum @10 21600 0"></v:f></v:formulas><v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"></v:path><o:lock v:ext="edit" aspectratio="t"></o:lock></v:shapetype><v:shape style="WIDTH: 0.75pt; HEIGHT: 0.75pt; VISIBILITY: visible; mso-wrap-style: square" id=Picture_x0020_1 alt="Description: https://i2.social.microsoft.com/Forums/resources/images/trans.gif?cver=2.13.0068.2" href="https://social.msdn.microsoft.com/Forums/en-US/Geneva/thread/35c10fe5-9693-4f3a-9c5c-8afbb423ee95?outputAs=rss" o:button="t" o:spid="_x0000_i1025" type="#_x0000_t75" mce_href="https://social.msdn.microsoft.com/Forums/en-US/Geneva/thread/35c10fe5-9693-4f3a-9c5c-8afbb423ee95?outputAs=rss"><v:fill o:detectmouseclick="t"></v:fill><v:imagedata src="file:///C:\Users\aszego\AppData\Local\Temp\msohtmlclip1\01\clip_image001.gif" o:title="trans.gif?cver=2.13.0068" mce_src="file:///C:\Users\aszego\AppData\Local\Temp\msohtmlclip1\01\clip_image001.gif"></v:imagedata></v:shape></SPAN></A>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #333333">CryptographicException - Object identifier (OID) is unknown</SPAN><A href="https://social.msdn.microsoft.com/Forums/en-US/Geneva/thread/35c10fe5-9693-4f3a-9c5c-8afbb423ee95?outputAs=rss"><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #333333; TEXT-DECORATION: none; mso-no-proof: yes; text-underline: none"><v:shapetype id=_x0000_t75 coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"> <v:stroke joinstyle="miter"></v:stroke><v:formulas><v:f eqn="if lineDrawn pixelLineWidth 0"></v:f><v:f eqn="sum @0 1 0"></v:f><v:f eqn="sum 0 0 @1"></v:f><v:f eqn="prod @2 1 2"></v:f><v:f eqn="prod @3 21600 pixelWidth"></v:f><v:f eqn="prod @3 21600 pixelHeight"></v:f><v:f eqn="sum @0 0 1"></v:f><v:f eqn="prod @6 1 2"></v:f><v:f eqn="prod @7 21600 pixelWidth"></v:f><v:f eqn="sum @8 21600 0"></v:f><v:f eqn="prod @7 21600 pixelHeight"></v:f><v:f eqn="sum @10 21600 0"></v:f></v:formulas><v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"></v:path><o:lock v:ext="edit" aspectratio="t"></o:lock></v:shapetype><v:shape style="WIDTH: 0.75pt; HEIGHT: 0.75pt; VISIBILITY: visible; mso-wrap-style: square" id=Picture_x0020_1 alt="Description: https://i2.social.microsoft.com/Forums/resources/images/trans.gif?cver=2.13.0068.2" href="https://social.msdn.microsoft.com/Forums/en-US/Geneva/thread/35c10fe5-9693-4f3a-9c5c-8afbb423ee95?outputAs=rss" o:button="t" o:spid="_x0000_i1025" type="#_x0000_t75"><v:fill o:detectmouseclick="t"></v:fill><v:imagedata src="file:///C:\Users\aszego\AppData\Local\Temp\msohtmlclip1\01\clip_image001.gif" o:title="trans.gif?cver=2.13.0068"></v:imagedata></v:shape></SPAN></A><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #333333"><o:p></o:p></SPAN></P><SPAN style="mso-bidi-font-family: 'Segoe UI'"><o:p></o:p></SPAN>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #333333">System.Security.Cryptography.X509Certificates.X509Utils._GetAlgIdFromOid(String oid) +0<BR>&nbsp;&nbsp; System.Security.Cryptography.X509Certificates.X509Utils.OidToAlgId(String oid) +37<BR>&nbsp;&nbsp; System.Security.Cryptography.RSACryptoServiceProvider.SignHash(Byte[] rgbHash, String str) +61<BR>&nbsp;&nbsp; System.Security.Cryptography.RSAPKCS1SignatureFormatter.CreateSignature(Byte[] rgbHash) +105<BR>&nbsp;&nbsp; System.Security.Cryptography.AsymmetricSignatureFormatter.CreateSignature(HashAlgorithm hash) +48<o:p></o:p></SPAN></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #333333">...<o:p></o:p></SPAN></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal>This was the first time I saw this exception, and I haven’t found any previous reports from customers on this in our internal knowledgebase (most likely due to WIF being a quite new product). Fortunately, binging around brought me quickly to a thread on <A href="https://social.msdn.microsoft.com/Forums/en-US/Geneva/thread/35c10fe5-9693-4f3a-9c5c-8afbb423ee95" mce_href="https://social.msdn.microsoft.com/Forums/en-US/Geneva/thread/35c10fe5-9693-4f3a-9c5c-8afbb423ee95">https://social.msdn.microsoft.com/Forums/en-US/Geneva/thread/35c10fe5-9693-4f3a-9c5c-8afbb423ee95</A>.<o:p></o:p></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal>Phil Bolduc and Brent Schmaltz have found the cause for this issue. The encryption algorithm used by Geneva is not registered correctly on Windows Server 2003 for use by the .NET Framework. Indeed, the following steps resolved the issue:<o:p></o:p></P>
<P style="TEXT-INDENT: -18pt; MARGIN: 0cm 0cm 0pt 18pt; mso-list: l0 level1 lfo1; mso-add-space: auto" class=MsoListParagraphCxSpFirst><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore">1.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN>Download&nbsp;Security.Cryptography.dll (either the binary of the source) from <A href="https://clrsecurity.codeplex.com/" mce_href="https://clrsecurity.codeplex.com/"><FONT color=#0000ff>https://clrsecurity.codeplex.com/</FONT></A><o:p></o:p></P>
<P style="TEXT-INDENT: -18pt; MARGIN: 0cm 0cm 0pt 18pt; mso-list: l0 level1 lfo1; mso-add-space: auto" class=MsoListParagraphCxSpMiddle><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore">2.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN>Create a console application that references this Security.Cryptography.dll<o:p></o:p></P>
<P style="TEXT-INDENT: -18pt; MARGIN: 0cm 0cm 10pt 18pt; mso-list: l0 level1 lfo1; mso-add-space: auto" class=MsoListParagraphCxSpLast><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore">3.<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN>Add the code below and execute the console application:<o:p></o:p></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt">using</SPAN><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"> Security.Cryptography;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"><o:p>&nbsp;</o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt">class</SPAN><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"> <SPAN style="COLOR: #2b91af">Program</SPAN><o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt">{<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">static</SPAN> <SPAN style="COLOR: blue">void</SPAN> Main(<SPAN style="COLOR: blue">string</SPAN>[] args)<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">Oid2</SPAN>.RegisterSha2OidInformationForRsa();<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt">}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><o:p>&nbsp;</o:p></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 10pt" class=MsoNormal>Note that on an x64 OS, you need to create a 32-bit executable to register this for 32-bit processes. <BR>Successful registration will create the following keys, respectively:<o:p></o:p></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 10pt" class=MsoNormal>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\OID\EncodingType 0\CryptDllFindOIDInfo<o:p></o:p></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 10pt" class=MsoNormal>HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Cryptography\OID\EncodingType 0\CryptDllFindOIDInfo<o:p></o:p></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 10pt" class=MsoNormal>These contain the 3 OIDs, which represent the 3 new SHA2 algorithms:<o:p></o:p></P>
<P style="LINE-HEIGHT: normal; TEXT-INDENT: -18pt; MARGIN: 0cm 0cm 0pt 18pt; mso-list: l1 level1 lfo2; mso-add-space: auto" class=MsoListParagraphCxSpFirst><SPAN style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"><SPAN style="mso-list: Ignore">·<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN>SHA256 - "2.16.840.1.101.3.4.2.1!1"<o:p></o:p></P>
<P style="LINE-HEIGHT: normal; TEXT-INDENT: -18pt; MARGIN: 0cm 0cm 0pt 18pt; mso-list: l1 level1 lfo2; mso-add-space: auto" class=MsoListParagraphCxSpMiddle><SPAN style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"><SPAN style="mso-list: Ignore">·<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN>SHA384 - "2.16.840.1.101.3.4.2.2!1"<o:p></o:p></P>
<P style="LINE-HEIGHT: normal; TEXT-INDENT: -18pt; MARGIN: 0cm 0cm 10pt 18pt; mso-list: l1 level1 lfo2; mso-add-space: auto" class=MsoListParagraphCxSpLast><SPAN style="FONT-FAMILY: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol"><SPAN style="mso-list: Ignore">·<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN>SHA512 - "2.16.840.1.101.3.4.2.3!1"<o:p></o:p></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 10pt" class=MsoNormal>As far as I can see, the issue is present on .NET 4.0 RTM as well.</o:p></FONT></FONT></P>]]></content:encoded>
    </item>
    <item>
      <title>Garbage collection vs. expression evaluation</title>
      <link>https://docs.microsoft.com/archive/blogs/aszego/garbage-collection-vs-expression-evaluation</link>
      <pubDate>Fri, 23 Apr 2010 07:05:00 GMT</pubDate>
      <dc:creator><![CDATA[Akos]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/aszego/2010/04/23/garbage-collection-vs-expression-evaluation/</guid>
      <description><![CDATA[A few months ago, a customer contacted us with a problem that seemed to be related to WCF. As it...]]></description>
      <content:encoded><![CDATA[<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT size=3><FONT face=Calibri>A few months ago, a customer contacted us with a problem that seemed to be related to WCF. As it turned out, its roots were deep within the CLR…<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></FONT></FONT></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT size=3><FONT face=Calibri>The error was indeed thrown by WCF: it was a System.ServiceModel.CommunicationObjectAbortedException: “The communication object, System.ServiceModel.Channels.HttpChannelFactory+HttpRequestChannel, cannot be used for communication because it has been Aborted.” There were two factors that made this error mysterious, right from the beginning:<o:p></o:p></FONT></FONT></P>
<P style="TEXT-INDENT: -18pt; MARGIN: 0cm 0cm 0pt 36pt; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpFirst><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore"><FONT size=3 face=Calibri>1.</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT size=3><FONT face=Calibri>Issue appeared only in release build, and there it was pretty consistently reproducible. Debug build didn’t exhibit this behavior.<o:p></o:p></FONT></FONT></P>
<P style="TEXT-INDENT: -18pt; MARGIN: 0cm 0cm 10pt 36pt; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpLast><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore"><FONT size=3 face=Calibri>2.</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT size=3><FONT face=Calibri>The exception was thrown during the first call through a properly created WCF channel on the client-side. Why would its underlying channel be aborted?<o:p></o:p></FONT></FONT></P>
<H2 style="MARGIN: 10pt 0cm 0pt"><FONT size=4><FONT color=#e36c0a><FONT face=Cambria>Repro on the rescue<o:p></o:p></FONT></FONT></FONT></H2>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT size=3><FONT face=Calibri>Fortunately, I could reproduce the problem on my machine with customer’s application. At the first glance, it wasn’t obvious what’s happening: in one single (but complex) line of code, among many other things, this particular HttpRequestChannel also got created somewhere deep in WCF, but when preparation was complete to issue the call – still on the same line – the HttpRequestChannel was already aborted.<o:p></o:p></FONT></FONT></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT size=3><FONT face=Calibri>It was a really long line: first, it called a function that created a WCF Channel via a few function calls, and put it into a templatized wrapper type, implementing IDisposable. Once this type was returned, its member function was called, to obtain the ServiceContract’s interface for the channel. On this interface, an actual method was called with some parameters.<o:p></o:p></FONT></FONT></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT size=3><FONT face=Calibri>So I wanted to find out who’s aborting the HttpRequestChannel. It was called from, <SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri">System.ServiceModel.ICommunicationObject.Close, which in turn got called by customer’s templatized wrapper. This was where things got more interesting. Obviously, this call must have happened on a different thread then the one executing that single line of code. But which thread? It wasn’t hard to find out from the call stack: it was the finalizer thread.<o:p></o:p></SPAN></FONT></FONT></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT size=3><FONT face=Calibri><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri">Now the picture cleared out. The debugger showed that the wrapper object wasn’t rooted anywhere. So indeed it was a candidate for GC, and because WCF channel creation is a heavy-weight operation, it did induce GC. With debug build, the compiled IL code looks to be more conservative and puts these things into “temporary variables” on the stack.</SPAN><o:p></o:p></FONT></FONT></P>
<H2 style="MARGIN: 10pt 0cm 0pt"><FONT size=4><FONT color=#e36c0a><FONT face=Cambria>Lessons learnt<o:p></o:p></FONT></FONT></FONT></H2>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri"><FONT size=3><FONT face=Calibri>But why wasn’t this object rooted on the stack at least?<o:p></o:p></FONT></FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri"><FONT size=3><FONT face=Calibri>Because it was a temporary result of expression evaluation. This makes sense, since only parameters, locals and call addresses are stored on the stack, but no temporary objects (unless we’re in debug build). Still it surprised me that temporaries are not preserved at least until the evaluation of the current expression finishes. C++, for example, guarantees that destructors won’t be called until the expression evaluation completes.<o:p></o:p></FONT></FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><SPAN style="mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-family: Calibri"><FONT size=3><FONT face=Calibri>However, managed code is different. I learnt from a developer on the CLR that such temporaries are not guaranteed to remain alive. Most of the time, of course, you don’t need to count with such side-effects. However, be aware that GC is non-deterministic and everything that is not rooted can be eliminated at any time. Knowing this can help tracking down insidious bugs like this.</FONT></FONT></SPAN></P>]]></content:encoded>
    </item>
    <item>
      <title>Service metadata: size does matter</title>
      <link>https://docs.microsoft.com/archive/blogs/aszego/service-metadata-size-does-matter</link>
      <pubDate>Thu, 04 Feb 2010 08:11:00 GMT</pubDate>
      <dc:creator><![CDATA[Akos]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/aszego/2010/02/04/service-metadata-size-does-matter/</guid>
      <description><![CDATA[Web services use standards like WSDL and WS-Policy to describe themselves in an interoperable...]]></description>
      <content:encoded><![CDATA[<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT size=3 face=Calibri>Web services use standards like WSDL and WS-Policy to describe themselves in an interoperable format. When you use WCF to implement your web service, generating the metadata is fortunately not your job (assuming you haven’t defined any custom binding elements).</FONT></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT size=3 face=Calibri>However, if you have a service that exposes many endpoints or operations (or both), than the WSDL can grow pretty large. Especially when applying security to the service the wsp:Policy parts of the document can became quite large. So large, that under certain circumstances, you won’t be able to consume the resulting XML.</FONT></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT size=3 face=Calibri>In case of svcutil.exe, this manifests itself with an error message similar to the following:</FONT></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'"><FONT size=3>Metadata contains a reference that cannot be resolved: 'net.tcp://172.22.3.68:55301/mex'.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'"><FONT size=3>There is an error in the XML document.<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'"><FONT size=3>There is an error in the XML document.<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'"><FONT size=3>The maximum nametable character count quota (16384) has been exceeded while reading XML data. The nametable is a data structure used to store strings encountered during XML processing - long XML documents with non-repeating element names, attribute names and attribute values may trigger this quota. This quota may be increased by changing the MaxNameTableCharCount property on the XmlDictionaryReaderQuotas object used when creating the XML reader.<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'"><FONT size=3>If the service is defined in the current solution, try building the solution and adding the service reference again.<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt" class=MsoNoSpacing><FONT size=3 face=Calibri>It could also include the following warning:</FONT></P>
<P style="MARGIN: 0cm 0cm 0pt" class=MsoNoSpacing><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0cm 0cm 0pt" class=MsoNoSpacing><SPAN style="FONT-FAMILY: 'Courier New'"><FONT size=3>Warning: The policy expression was not fully imported because it exceeded the maximum allowable complexity. The import stopped at element element_name.<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt" class=MsoNoSpacing><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0cm 0cm 0pt" class=MsoNoSpacing><FONT size=3><FONT face=Calibri>As the error message suggests, the large metadata document caused the </FONT><SPAN style="FONT-FAMILY: 'Courier New'">XmlDictionaryReader</SPAN><FONT face=Calibri> to hit a certain quota, in this case,<SPAN style="mso-spacerun: yes">&nbsp;</SPAN></FONT><SPAN style="FONT-FAMILY: 'Courier New'">MaxNameTableCharCount</SPAN><FONT face=Calibri>.</FONT></FONT></P>
<P style="MARGIN: 0cm 0cm 0pt" class=MsoNoSpacing><FONT size=3 face=Calibri>These quotas aren’t there just for nagging us. XML processing is a memory and CPU intensive task, and these quotas provide a built-in protection against misuse, such as DoS attacks with specially crafted XMLs (to give an idea about such XMLs: thousands of nested nodes, extreme long element names, etc.). </FONT></P>
<P style="MARGIN: 0cm 0cm 0pt" class=MsoNoSpacing><FONT size=3><FONT face=Calibri>So, the hint is to raise the specific quota we’re hitting in </FONT><SPAN style="FONT-FAMILY: 'Courier New'">XmlDictionaryReaderQuotas</SPAN><FONT face=Calibri>. But svcutil.exe is a compiled binary, so how are we going to accomplish this?</FONT></FONT></P>
<P style="MARGIN: 0cm 0cm 0pt" class=MsoNoSpacing><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0cm 0cm 0pt" class=MsoNoSpacing><FONT size=3><FONT face=Calibri>We’re lucky again, because svcutil.exe is a WCF application, and the </FONT><SPAN style="FONT-FAMILY: 'Courier New'">XmlDictionaryReader</SPAN><FONT face=Calibri> is actually used by WCF and not svcutil.exe directly. Hence, it’s possible to set the quotas by configuring the binding in svcutil.exe.config. The following example demonstrates this.</FONT></FONT></P>
<P style="MARGIN: 0cm 0cm 0pt" class=MsoNoSpacing><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">&lt;?</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">xml</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"> </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes">version</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">=</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">"<SPAN style="COLOR: blue">1.0</SPAN>"<SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: red">encoding</SPAN><SPAN style="COLOR: blue">=</SPAN>"<SPAN style="COLOR: blue">utf-8</SPAN>"<SPAN style="COLOR: blue">?&gt;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">&lt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">configuration</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">&gt;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>&lt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">system.serviceModel</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">&gt;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>&lt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">client</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">&gt;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">endpoint</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"> </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes">name</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">=</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">"<SPAN style="COLOR: blue">net.tcp</SPAN>"<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes">binding</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">=</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">"<SPAN style="COLOR: blue">netTcpBinding</SPAN>"<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes">bindingConfiguration</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">=</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">"<SPAN style="COLOR: blue">GenericBinding</SPAN>"<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes">contract</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">=</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">"<SPAN style="COLOR: blue">IMetadataExchange</SPAN>"<SPAN style="COLOR: blue"> /&gt;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">endpoint</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"> </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes">name</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">=</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">"<SPAN style="COLOR: blue">http</SPAN>"<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes">binding</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">=</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">"<SPAN style="COLOR: blue">wsHttpBinding</SPAN>"<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes">bindingConfiguration</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">=</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">"<SPAN style="COLOR: blue">SecureBinding</SPAN>"<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes">contract</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">=</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">"<SPAN style="COLOR: blue">IMetadataExchange</SPAN>"<SPAN style="COLOR: blue"> /&gt;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>&lt;/</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">client</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">&gt;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>&lt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">bindings</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">&gt;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">netTcpBinding</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">&gt;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">binding</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"> </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes">name</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">=</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">"<SPAN style="COLOR: blue">GenericBinding</SPAN>"<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes">maxBufferPoolSize</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">=</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">"<SPAN style="COLOR: blue">2147483647</SPAN>"<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes">maxBufferSize</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">=</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">"<SPAN style="COLOR: blue">2147483647</SPAN>"<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes">maxReceivedMessageSize</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">=</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">"<SPAN style="COLOR: blue">2147483647</SPAN>"<SPAN style="COLOR: blue"> &gt;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">readerQuotas</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"> </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes">maxDepth</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">=</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">"<SPAN style="COLOR: blue">2147483647</SPAN>"<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes">maxStringContentLength</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">=</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">"<SPAN style="COLOR: blue">2147483647</SPAN>"<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes">maxArrayLength</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">=</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">"<SPAN style="COLOR: blue">2147483647</SPAN>"<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes">maxBytesPerRead</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">=</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">"<SPAN style="COLOR: blue">2147483647</SPAN>"<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes">maxNameTableCharCount</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">=</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">"<SPAN style="COLOR: blue">2147483647</SPAN>"<SPAN style="COLOR: blue"> /&gt;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">security</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"> </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes">mode</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">=</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">"<SPAN style="COLOR: blue">None</SPAN>"<SPAN style="COLOR: blue">/&gt;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;/</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">binding</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">&gt;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;/</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">netTcpBinding</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">&gt;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">wsHttpBinding</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">&gt;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">binding</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"> </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes">name</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">=</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">"<SPAN style="COLOR: blue">SecureBinding</SPAN>"<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN></SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes">maxBufferPoolSize</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">=</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">"<SPAN style="COLOR: blue">2147483647</SPAN>"<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes">maxBufferSize</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">=</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">"<SPAN style="COLOR: blue">2147483647</SPAN>"<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes">maxReceivedMessageSize</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">=</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">"<SPAN style="COLOR: blue">2147483647</SPAN>"<SPAN style="COLOR: blue"> &gt;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">readerQuotas</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"> </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes">maxDepth</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">=</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">"<SPAN style="COLOR: blue">2147483647</SPAN>"<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes">maxStringContentLength</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">=</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">"<SPAN style="COLOR: blue">2147483647</SPAN>"<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes">maxArrayLength</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">=</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">"<SPAN style="COLOR: blue">2147483647</SPAN>"<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes">maxBytesPerRead</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">=</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">"<SPAN style="COLOR: blue">2147483647</SPAN>"<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes">maxNameTableCharCount</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">=</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">"<SPAN style="COLOR: blue">2147483647</SPAN>"<SPAN style="COLOR: blue"> /&gt;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">security</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"> </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes">mode</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">=</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">"<SPAN style="COLOR: blue">Message</SPAN>"<SPAN style="COLOR: blue">&gt;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">transport</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"> </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes">clientCredentialType</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">=</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">"<SPAN style="COLOR: blue">Windows</SPAN>"<SPAN style="COLOR: blue"> /&gt;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;/</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">security</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">&gt;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;/</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">binding</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">&gt;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;/</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">wsHttpBinding</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">&gt;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>&lt;/</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">bindings</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">&gt;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>&lt;/</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">system.serviceModel</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">&gt;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">&lt;/</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">configuration</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">&gt;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; BACKGROUND: white; COLOR: blue; FONT-SIZE: 10pt; mso-highlight: white; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt" class=MsoNoSpacing><FONT face=Calibri><FONT size=3>Note that the configuration must be done per binding, and that we actually configure the endpoints that svcutil.exe uses (these have preconfigured names like ‘http’). </FONT><FONT size=3>Correspondingly, other aspects of the bindings (mainly security) must match with those of the service metadata endpoint.</FONT></P></FONT>
<P style="MARGIN: 0cm 0cm 0pt" class=MsoNoSpacing><FONT size=3 face=Calibri>The pre-requisite is that System.servicemodel.dll should be at least version 3.0.4506.722, corresponding to the hotfix </FONT><A href="https://support.microsoft.com/kb/951111"><FONT size=3 face=Calibri>https://support.microsoft.com/kb/951111</FONT></A><FONT size=3 face=Calibri>. Versions 3.5 SP1 (3.0 SP2) of the .NET Framework already contain this.</FONT></P>]]></content:encoded>
    </item>
    <item>
      <title>Tool of the month: Microsoft Service Trace Viewer</title>
      <link>https://docs.microsoft.com/archive/blogs/aszego/tool-of-the-month-microsoft-service-trace-viewer</link>
      <pubDate>Mon, 01 Feb 2010 08:14:00 GMT</pubDate>
      <dc:creator><![CDATA[Akos]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/aszego/2010/02/01/tool-of-the-month-microsoft-service-trace-viewer/</guid>
      <description><![CDATA[I was quite busy during the last two months, but today I’m back with a new post.
If you use WCF,...]]></description>
      <content:encoded><![CDATA[<FONT size=3 face=Calibri>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal>I was quite busy during the last two months, but today I’m back with a new post.</P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal>If you use WCF, you’ve probably already come across this tool, which is mostly marketed as WCF’s troubleshooting companion. However, it’s actually a very useful utility for general .NET troubleshooting. Note that this post does not aim to be a complete guide to WCF tracing, which is documented <A href="https://msdn.microsoft.com/en-us/library/ms733025.aspx">here</A>. Instead, it gives some background to tracing and shows where Service Trace Viewer really shines. </P>
<H2 style="MARGIN: 10pt 0cm 0pt"><FONT color=#e36c0a size=4 face=Cambria>Tracing on .NET standards</FONT></H2>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal>WCF builds on the well established <SPAN style="FONT-FAMILY: 'Courier New'">System.Diagnostics</SPAN> namespace to produce traces. This is not just a good design decision to reuse code, but also allows to share common concepts with other types of .NET tracing sources.</P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal>The most important concept here is <B style="mso-bidi-font-weight: normal">activities</B>. An activity is a container for a series of logically related operations. For example, everything that constitutes sending a message to a server could be grouped into a single activity. If one step itself consists of fair amount of work, it could have its own activity. The great thing about activities is that any trace output will be associated to the current activity (using a thread-static variable containing the ActivityId). This allows you to understand the context of a trace output.<BR>Furthermore, activities are hierarchical – so, another way of looking at them is a logical call stack. This enables us to put trace events into an even broader context.</P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal>Another concept is a <B style="mso-bidi-font-weight: normal">listener</B>. They act as collectors for trace sources in .NET. Listeners can be either private or shared, but as you’d guess, a shared one has the advantage of collecting trace output from various sources. If you’re planning to use Service Trace Viewer, you’ll need to employ <SPAN style="FONT-FAMILY: 'Courier New'">System.Diagnostics.XmlWriterTraceListener</SPAN>, because this is the native format for the tool.</P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal>When used together, you can group traces from various sources into a single log file, and have a great overview of what’s happening in the process. <BR>For an example, let’s consider the following tracing configuration:</P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">&lt;?</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">xml</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"> </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes">version</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">=</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">"<SPAN style="COLOR: blue">1.0</SPAN>"<SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: red">encoding</SPAN><SPAN style="COLOR: blue">=</SPAN>"<SPAN style="COLOR: blue">utf-8</SPAN>"<SPAN style="COLOR: blue"> ?&gt;<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">&lt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">configuration</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">&gt;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>&lt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">system.diagnostics</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">&gt;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">sources</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">&gt;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">source</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"> </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes">name</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">=</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">"<SPAN style="COLOR: blue">System.ServiceModel</SPAN>"<SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: red">switchValue</SPAN><SPAN style="COLOR: blue">=</SPAN>"<SPAN style="COLOR: blue">Information,ActivityTracing</SPAN>"<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes">propagateActivity</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">=</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">"<SPAN style="COLOR: blue">true</SPAN>"<SPAN style="COLOR: blue">&gt;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">listeners</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">&gt;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">add</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"> </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes">name</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">=</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">"<SPAN style="COLOR: blue">ServiceModelTraceListener</SPAN>"<SPAN style="COLOR: blue">/&gt;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;/</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">listeners</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">&gt;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;/</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">source</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">&gt;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">source</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"> </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes">name</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">=</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">"<SPAN style="COLOR: blue">System.Net.Sockets</SPAN>"<SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: red">switchValue</SPAN><SPAN style="COLOR: blue">=</SPAN>"<SPAN style="COLOR: blue">Information</SPAN>"<SPAN style="COLOR: blue">&gt;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">listeners</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">&gt;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">add</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"> </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes">name</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">=</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">"<SPAN style="COLOR: blue">ServiceModelTraceListener</SPAN>"<SPAN style="COLOR: blue">/&gt;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;/</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">listeners</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">&gt;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;/</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">source</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">&gt;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">source</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"> </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes">name</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">=</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">"<SPAN style="COLOR: blue">System.Net</SPAN>"<SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: red">switchValue</SPAN><SPAN style="COLOR: blue">=</SPAN>"<SPAN style="COLOR: blue">Information</SPAN>"<SPAN style="COLOR: blue">&gt;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">listeners</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">&gt;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">add</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"> </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes">name</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">=</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">"<SPAN style="COLOR: blue">ServiceModelTraceListener</SPAN>"<SPAN style="COLOR: blue">/&gt;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;/</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">listeners</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">&gt;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;/</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">source</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">&gt;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;/</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">sources</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">&gt;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">sharedListeners</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">&gt;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">add</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"> </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes">initializeData</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">=</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">"<SPAN style="COLOR: blue">c:\temp\client_tracelog.svclog</SPAN>"<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes">type</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">=</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">"<SPAN style="COLOR: blue">System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</SPAN>"<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes">name</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">=</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">"<SPAN style="COLOR: blue">ServiceModelTraceListener</SPAN>"<SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: red">traceOutputOptions</SPAN><SPAN style="COLOR: blue">=</SPAN>"<SPAN style="COLOR: blue">LogicalOperationStack, DateTime, Timestamp, ProcessId, ThreadId, Callstack</SPAN>"<SPAN style="COLOR: blue">/&gt;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;/</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">sharedListeners</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">&gt;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>&lt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">trace</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"> </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes">autoflush</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">=</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">"<SPAN style="COLOR: blue">true</SPAN>"<SPAN style="COLOR: blue"> /&gt;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>&lt;/</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">system.diagnostics</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">&gt;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; TEXT-INDENT: 36pt; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">.<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; TEXT-INDENT: 36pt; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">.<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; TEXT-INDENT: 36pt; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0cm 0cm 10pt; BACKGROUND: #eeece1; mso-background-themecolor: background2" class=MsoNormal><SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">&lt;/</SPAN><SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes">configuration</SPAN><SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">&gt;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt" class=MsoNoSpacing><SPAN style="mso-no-proof: yes">This will trace all socket (</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes">System.Net.Sockets</SPAN><SPAN style="mso-no-proof: yes">), </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes">HttpWebRequest</SPAN><SPAN style="mso-no-proof: yes">, </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes">ServicePoint</SPAN><SPAN style="mso-no-proof: yes">, etc. (</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes">System.Net</SPAN><SPAN style="mso-no-proof: yes">) and WCF (</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes">System.ServiceModel</SPAN><SPAN style="mso-no-proof: yes">) activities at Information level, with the nice context that activities provide (for more informatino on the former trace sources, surf to </SPAN><A href="https://msdn.microsoft.com/en-us/library/ty48b824(VS.80).aspx"><SPAN style="mso-no-proof: yes">https://msdn.microsoft.com/en-us/library/ty48b824(VS.80).aspx</SPAN></A><SPAN style="mso-no-proof: yes">). This is best viewed with the “Graph” mode within </SPAN>Service Trace Viewer:</P>
<P style="MARGIN: 0cm 0cm 0pt" class=MsoNoSpacing mce_keep="true">&nbsp;</P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal></FONT><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/aszego/WindowsLiveWriter/ToolofthemonthServiceModelTraceViewer_EFC6/image_6.png" original-url="https://blogs.msdn.com/blogfiles/aszego/WindowsLiveWriter/ToolofthemonthServiceModelTraceViewer_EFC6/image_6.png" mce_href="https://blogs.msdn.com/blogfiles/aszego/WindowsLiveWriter/ToolofthemonthServiceModelTraceViewer_EFC6/image_6.png"><IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=image border=0 alt=image src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/aszego/WindowsLiveWriter/ToolofthemonthServiceModelTraceViewer_EFC6/image_thumb_2.png" original-url="https://blogs.msdn.com/blogfiles/aszego/WindowsLiveWriter/ToolofthemonthServiceModelTraceViewer_EFC6/image_thumb_2.png" width=446 height=415 mce_src="https://blogs.msdn.com/blogfiles/aszego/WindowsLiveWriter/ToolofthemonthServiceModelTraceViewer_EFC6/image_thumb_2.png"></A> </P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><SPAN style="mso-no-proof: yes"><FONT size=3><FONT face=Calibri><SHAPETYPE id=_x0000_t75 coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"><STROKE joinstyle="miter"></STROKE><FORMULAS><F eqn="if lineDrawn pixelLineWidth 0"></F><F eqn="sum @0 1 0"></F><F eqn="sum 0 0 @1"></F><F eqn="prod @2 1 2"></F><F eqn="prod @3 21600 pixelWidth"></F><F eqn="prod @3 21600 pixelHeight"></F><F eqn="sum @0 0 1"></F><F eqn="prod @6 1 2"></F><F eqn="prod @7 21600 pixelWidth"></F><F eqn="sum @8 21600 0"></F><F eqn="prod @7 21600 pixelHeight"></F><F eqn="sum @10 21600 0"></F></FORMULAS><PATH o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"></PATH><LOCK v:ext="edit" aspectratio="t"></LOCK></SHAPETYPE><SHAPE style="WIDTH: 649.5pt; HEIGHT: 602.25pt; VISIBILITY: visible; mso-wrap-style: square" id=Picture_x0020_4 o:spid="_x0000_i1026" type="#_x0000_t75"><IMAGEDATA mce_src="file:///C:\Users\aszego\AppData\Local\Temp\msohtmlclip1\01\clip_image001.png" src="file:///C:\Users\aszego\AppData\Local\Temp\msohtmlclip1\01\clip_image001.png" o:title="o:title"></IMAGEDATA></SHAPE></FONT></FONT></SPAN></P><FONT size=3 face=Calibri>
<P style="MARGIN: 0cm 0cm 0pt" class=MsoNoSpacing>Note that you can double-click an activity transfer (e.g.’From: Processing message 1.’ below) to travel down or up in the hierarchy. Also, be aware that the tool by default hides activities and trace events that you haven’t visited yet. These can be unfolded using either the adjacent or the column header’s plus sign.</P>
<H2 style="MARGIN: 10pt 0cm 0pt"><FONT color=#e36c0a size=4 face=Cambria>End-to-End tracing</FONT></H2>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal>Fortunately, WCF provides the <SPAN style="FONT-FAMILY: 'Courier New'">propagateActivity</SPAN> attribute that essentially writes the current ActivityId to a special SOAP header. When a WCF service gets such a header, it’ll set its ActivityId to correlate processing with the corresponding client activity. When you’re done with collecting the traces, you just need to open any of the traces in Service Trace Viewer, and then use File | Add to correlate the other traces. <B style="mso-bidi-font-weight: normal">Message traces</B> are no exception: if you have traced messages into a separate log file (which is the default configuration when using WCF Service Configuration Editor), you can use this menu item to correlate them with the trace.</P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal>Using the same configuration above, a successful message sending and processing on server-side looks like:</P>
<P style="MARGIN: 0cm 0cm 0pt" class=MsoNoSpacing></FONT><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/aszego/WindowsLiveWriter/ToolofthemonthServiceModelTraceViewer_EFC6/image_4.png" original-url="https://blogs.msdn.com/blogfiles/aszego/WindowsLiveWriter/ToolofthemonthServiceModelTraceViewer_EFC6/image_4.png" mce_href="https://blogs.msdn.com/blogfiles/aszego/WindowsLiveWriter/ToolofthemonthServiceModelTraceViewer_EFC6/image_4.png"><IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=image border=0 alt=image src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/aszego/WindowsLiveWriter/ToolofthemonthServiceModelTraceViewer_EFC6/image_thumb_1.png" original-url="https://blogs.msdn.com/blogfiles/aszego/WindowsLiveWriter/ToolofthemonthServiceModelTraceViewer_EFC6/image_thumb_1.png" width=436 height=306 mce_src="https://blogs.msdn.com/blogfiles/aszego/WindowsLiveWriter/ToolofthemonthServiceModelTraceViewer_EFC6/image_thumb_1.png"></A> </P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><SPAN style="mso-no-proof: yes"><SHAPE style="WIDTH: 957pt; HEIGHT: 669pt; VISIBILITY: visible; mso-wrap-style: square" id=Picture_x0020_1 o:spid="_x0000_i1025" type="#_x0000_t75"><IMAGEDATA mce_src="file:///C:\Users\aszego\AppData\Local\Temp\msohtmlclip1\01\clip_image003.png" src="file:///C:\Users\aszego\AppData\Local\Temp\msohtmlclip1\01\clip_image003.png" o:title="o:title"><FONT size=3 face=Calibri></FONT></IMAGEDATA></SHAPE></SPAN></P><FONT size=3 face=Calibri>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal>Notice that the tool nicely connects the correlated activities with a blue arrow between client and server. Of course, there’s nothing that would limit such correlation to a client-server scenario – an n-tier application’s internal processing could be followed just as well.</P>
<H2 style="MARGIN: 10pt 0cm 0pt"><FONT color=#e36c0a size=4 face=Cambria>Custom traces</FONT></H2>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal>Just like WCF uses System.Diagnostics for tracing purposes, it’s a good idea to use it for your custom tracing, too. With Service Trace Viewer, it’s an even better idea <SPAN style="FONT-FAMILY: Wingdings; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-char-type: symbol; mso-symbol-font-family: Wingdings"><SPAN style="mso-char-type: symbol; mso-symbol-font-family: Wingdings">J</SPAN></SPAN>. See <A href="https://msdn.microsoft.com/en-us/library/aa738759.aspx">https://msdn.microsoft.com/en-us/library/aa738759.aspx</A> for code samples on how to do this.</P>
<H2 style="MARGIN: 10pt 0cm 0pt"><FONT color=#e36c0a size=4 face=Cambria>Also displays ETW traces</FONT></H2>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal>While not directly related to the discussion above, it’s good to know that whenever you have to view ETW traces (*.etl files) collected from Windows Log Manager, you can use Service Trace Viewer as it supports this format. You can even collect ETW traces along with .NET traces. Details are here: <A href="https://msdn.microsoft.com/en-us/library/ms751538.aspx">https://msdn.microsoft.com/en-us/library/ms751538.aspx</A>. </P>
<H2 style="MARGIN: 10pt 0cm 0pt"><FONT color=#e36c0a size=4 face=Cambria>Searching, Filtering, etc.</FONT></H2>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal>Service Trace Viewer has a few more handy features. I encourage you to have a look at its MSDN documentation, <A href="https://msdn.microsoft.com/en-us/library/ms732023.aspx">https://msdn.microsoft.com/en-us/library/ms732023.aspx</A>.</P></FONT>]]></content:encoded>
    </item>
    <item>
      <title>CAtlHttpClient and NTLM authentication</title>
      <link>https://docs.microsoft.com/archive/blogs/aszego/catlhttpclient-and-ntlm-authentication</link>
      <pubDate>Thu, 19 Nov 2009 08:28:00 GMT</pubDate>
      <dc:creator><![CDATA[Akos]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/aszego/2009/11/19/catlhttpclient-and-ntlm-authentication/</guid>
      <description><![CDATA[I’m working on a customer problem that revolves around NTLM authentication. To cut a long story...]]></description>
      <content:encoded><![CDATA[<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT size=3 face=Calibri>I’m working on a customer problem that revolves around NTLM authentication. To cut a long story short, it seems that customer’s client (which builds on ATL Server*) stopped authenticating its requests with IIS. While the actual cause of customer’s problem is still being investigated, I’ve already found one possible reason for such a behavior.</FONT></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT size=3 face=Calibri>This is a breaking change in ATL Server that dates back to Visual Studio 2005. It makes CAtlHttpClient refrain from authentication if the Internet Explorer security zone policy does not allow sending user credentials silently to the remote host, determined by its URL. Following is the identical code snippet from latest CodePlex version, atlhttp.inl @ line 1259:</FONT></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">DWORD dwPolicy=0xFFFF;<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">hr=spSecurityMgr-&gt;ProcessUrlAction(strUrlW.GetString(),<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>URLACTION_CREDENTIALS_USE,<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>reinterpret_cast</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">&lt;BYTE*&gt;(&amp;dwPolicy),<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>sizeof</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">(dwPolicy),<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>NULL,<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>0,<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>PUAF_NOUI,<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>NULL);<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">if</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"> (FAILED(hr) || dwPolicy != URLPOLICY_CREDENTIALS_SILENT_LOGON_OK)<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">{<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>return</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"> <SPAN style="COLOR: blue">false</SPAN>;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1; mso-background-themecolor: background2; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT size=3 face=Calibri></FONT>&nbsp;</P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT size=3 face=Calibri>This code essentially queries </FONT><SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt">IInternetSecurityManager::ProcessUrlAction</SPAN><FONT size=3 face=Calibri> for security policy that applies to the URL. This is the same policy system that Internet Explorer uses. If the policy doesn’t allow silent logon using the current user’s credentials, we don’t authenticate.</FONT></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT size=3 face=Calibri>The solution here is to add the URL to a privileged zone and in Internet Explorer, and enable “User Authentication – Logon – Automatic Logon with current username and password” in custom level for that zone. Note that the zone could be either Intranet or Trusted sites, but the default “Anonymous logon only in Intranet zone” doesn’t appear to be sufficient.</FONT></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT size=3 face=Calibri>* Beginning with Visual Studio 2008, ATL Server and Tools is not part of the product any more. Instead, it became an open-source project on </FONT><A href="https://atlserver.codeplex.com/"><FONT size=3 face=Calibri>CodePlex</FONT></A><FONT size=3 face=Calibri>. This also means that there’s no support for ATL Server and Tools versions that you can download from CodePlex. Of course, the previous version of ATL Server and Tools is supported within the timeline of Visual Studio 2005 life cycle.</FONT></P>]]></content:encoded>
    </item>
    <item>
      <title>WCF Performance Counters</title>
      <link>https://docs.microsoft.com/archive/blogs/aszego/wcf-performance-counters</link>
      <pubDate>Mon, 19 Oct 2009 05:36:00 GMT</pubDate>
      <dc:creator><![CDATA[Akos]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/aszego/2009/10/19/wcf-performance-counters/</guid>
      <description><![CDATA[WCF offers its own set of performance counters, which allow you to observe the live performance of...]]></description>
      <content:encoded><![CDATA[<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT size=3 face=Calibri>WCF offers its own set of performance counters, which allow you to observe the live performance of your services, from various aspects. However, WCF does not publish performance counter data by default, and even when enabled, you can choose which categories of counters are published. As you expect, this is designed so with a reason.</FONT></P>
<H2 style="MARGIN: 10pt 0cm 0pt"><FONT color=#e36c0a size=4 face=Cambria>Shared memory concerns</FONT></H2>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT size=3 face=Calibri>Besides the obvious performance overhead, managed performance counters also consume memory that is shared among .NET processes running on the machine. This committed memory is backed by the page file, so its size counts to the overall system commit. The memory area is set up per performance counter category, and has a default size of 128KB.</FONT></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT size=3 face=Calibri>So, the size of this memory area should be kept small. However, when all memory counters are enabled WCF, then – depending on your services – the counters (or more precisely, counter instances) will consume a considerable part of these shared memory areas:</FONT></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt" class=MsoNormal><FONT size=3><FONT face=Calibri>•<SPAN style="mso-tab-count: 1"> </SPAN>15 performance counters for each instance of operation (per endpoint across all services).<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></FONT></FONT></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt" class=MsoNormal><FONT size=3><FONT face=Calibri>•<SPAN style="mso-tab-count: 1"> </SPAN>19 performance counters for each instance of endpoint (across all services).<o:p></o:p></FONT></FONT></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt" class=MsoNormal><FONT size=3 face=Calibri>•<SPAN style="mso-tab-count: 1"> </SPAN>33 performance counters for each service.</FONT></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT size=3 face=Calibri>This means quite many counter instances for the category “ServiceModelOperation 3.0.0.0”. If you have say 10 operations per endpoint, 10 endpoints in each service and 10 services, you’ll end up with 10 x 10 x 10 x 15 = 15 000 performance counter instances for this category.</FONT></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT size=3 face=Calibri>But how many bytes does one instance need? Among other factors, this also depends on the name of the counter instances, which tend to be long in WCF (combination of service, endpoint and operation name). According to my measurements, they need approximately 320-350 bytes each.</FONT></P>
<H2 style="MARGIN: 10pt 0cm 0pt"><FONT color=#e36c0a size=4 face=Cambria>Summing it up</FONT></H2>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT size=3 face=Calibri>Writing this back to our formula above, our hypothetical scenario would need 15&nbsp;000 x 350 = 5&nbsp;250&nbsp;000 bytes of shared memory for “ServiceModelOperation 3.0.0.0” alone. Sure enough, in such cases the default 128KB won’t be enough for this category. When this happens, WCF notifies you by writing "System.InvalidOperationException: Custom counters file view is out of memory." to the application event log and in the ServiceModel trace.</FONT></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT size=3 face=Calibri>The solution is to specify a </FONT><A href="https://msdn.microsoft.com/en-us/library/ms229387.aspx" mce_href="https://msdn.microsoft.com/en-us/library/ms229387.aspx"><FONT size=3 face=Calibri>fileMappingSize</FONT></A><FONT size=3 face=Calibri> suitable for your needs in either machine.config or the registry. I’d recommend the latter, since the registry setting allows doing this per category.</FONT></P>]]></content:encoded>
    </item>
    <item>
      <title>Avoid using Assembly.LoadFrom</title>
      <link>https://docs.microsoft.com/archive/blogs/aszego/avoid-using-assembly-loadfrom</link>
      <pubDate>Fri, 16 Oct 2009 05:44:00 GMT</pubDate>
      <dc:creator><![CDATA[Akos]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/aszego/2009/10/16/avoid-using-assembly-loadfrom/</guid>
      <description><![CDATA[On MSDN, there’s a warning that using Assembly.LoadFrom() has disadvantages. The following could...]]></description>
      <content:encoded><![CDATA[<FONT face=Calibri>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT size=3>On MSDN, there’s a warning that using Assembly.LoadFrom() has </FONT><A href="https://msdn.microsoft.com/en-us/library/1009fa28.aspx"><FONT size=3>disadvantages</FONT></A><FONT size=3>. The following could be a good illustration of the problems that may arise.</FONT></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT size=3>Not long ago I had a customer who was using Assembly.LoadFrom() to load types into their web service on-demand. Intermittently, he received HTTP 500 errors on the client, which he tracked back to a strange exception thrown in the service:</FONT></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'"><FONT size=3>System.InvalidCastException: [A]&lt;type A&gt; cannot be cast to [B]&lt;type A&gt;. Type A originates from &lt;assembly A&gt; in the context 'LoadNeither' at location &lt;location A&gt;. Type A originates from &lt;assembly A&gt; in the context 'Default' at location &lt;location B&gt;.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT size=3>As if a given type was not castable to itself. I hope you noticed that the types described above do differ in their load contexts and their containing assembly’s location. This helps investigating such issues, thanks to the improved error message.</FONT></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT size=3>Indeed, the problem was that my customer placed his plug-in assemblies into the Bin directory, and therefore these assemblies got copied to the temporary folder that ASP.NET uses to compile the web application (or web service for that matter). This directory happens to be the private path for the application domain the web service is running in. This means that every assembly on this path can be loaded via Assembly.Load().<BR>Since client requests contained types from the plug-in assemblies, at some point, XmlSerializer tried de-serialize the XML. However, XmlSerializer is always using Assembly.Load() to load the required assembly into the default loading context. But types that customer was using in his code got loaded into a different context (LoadNeither in this case). As Suzanne Cook’s excellent post </FONT><A href="https://blogs.msdn.com/suzcook/archive/2004/06/02/debugging-an-invalidcastexception.aspx"><FONT size=3>explains</FONT></A><FONT size=3>, types loaded into different context are never castable to each other.</FONT></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><FONT size=3>Needless to say that this problem is not specific to web services or XmlSerializer. I’ve seen it also with .NET Remoting and the binary formatter, and very likely it can appear with other combinations of distributed frameworks and serializers.</FONT></P></FONT>]]></content:encoded>
    </item>
    <item>
      <title>Visual Basic 6 and .NET COM Interop</title>
      <link>https://docs.microsoft.com/archive/blogs/aszego/visual-basic-6-and-net-com-interop</link>
      <pubDate>Mon, 12 Oct 2009 05:04:00 GMT</pubDate>
      <dc:creator><![CDATA[Akos]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/aszego/2009/10/12/visual-basic-6-and-net-com-interop/</guid>
      <description><![CDATA[This is a quite popular topic on the Internet, and this has a reason: a lot of developers need to...]]></description>
      <content:encoded><![CDATA[<FONT size=3 face=Calibri>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal>This is a quite popular topic on the Internet, and this has a reason: a lot of developers need to integrate legacy components written in Visual Basic 6 with .NET.<BR>COM Interop is or should be one of the easiest ways to bring these two worlds together.</P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal>The problem begins when multiple threads, apartments or custom data types float into the picture.</P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal>Today I’d like to share an easy way to tackle with data type interop, plus an unexplained discovery I made during a recent case.</P>
<H2 style="MARGIN: 10pt 0cm 0pt"><FONT color=#e36c0a size=4 face=Cambria>The problem</FONT></H2>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal>My customer had a .NET method defined as follows:</P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 9pt; mso-bidi-font-size: 10.0pt">public</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 9pt; mso-bidi-font-size: 10.0pt"> <SPAN style="COLOR: blue">void</SPAN> SetData(<SPAN style="COLOR: #2b91af">Data</SPAN>[] param)<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 9pt; mso-bidi-font-size: 10.0pt">{<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; TEXT-INDENT: 36pt; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 9pt; mso-bidi-font-size: 10.0pt">...<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 9pt; mso-bidi-font-size: 10.0pt">}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><o:p>&nbsp;</o:p></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal>‘Data’ was his custom type, also defined in .NET.</P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal>When calling this method from Visual Basic 6 through COM interop, we get a run-time error: “Function or interface marked as restricted, or the function uses an Automation type not supported in Visual Basic”.</P>
<H2 style="MARGIN: 10pt 0cm 0pt"><FONT color=#e36c0a size=4 face=Cambria>It’s all about the TLB</FONT></H2>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal>When data is passed from client to server or back, chances are that it must be marshaled (i.e. converted). There’re a number of conditions that dictate this, e.g. different representation of data, the need to serialize and transmit data over network, etc.</P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal>However, (automated) marshaling cannot happen without some metadata describing the actual data types that are involved. With the advent of .NET, metadata is stored right in the assembly with the code. But in terms of COM, it was stored in a Type Library (TLB). The TLB itself is just a binary representation of the Interface Definition Language (IDL). TLB/IDL is the “common language” that all COM components or clients speak. It’s worth noting that IDL is a powerful language that can express constructs which are not supported by every programming language or runtime. Also keep in mind that a TLB can be included within an EXE or a DLL as a resource.</P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal>As for Visual Basic 6, it also relies on the TLB to make the types of the component usable in the client. When doing COM interop, the TLB is generated by the .NET SDK tools tlbexp.exe or regasm.exe.</P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal>Therefore, if using a managed type via COM interop from Visual Basic 6 doesn’t work out-of-the-box, then very likely there’s a problem with the TLB/IDL. The problem is not that the TLB is invalid, since then it couldn’t have been compiled at all. Rather, the most likely issue here is that one party (e.g. .NET) expresses a type with a construct that is not supported by the other party (Visual Basic 6). Some constructs do not exist at all, while others are just expressed otherwise. In the latter case, often the difference is not just syntactical, and thus the run-time of Visual Basic 6, for example, won’t be able to handle it.</P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal>Thus, we need to look at the TLB to find the problem. Simply look up the type that you’re trying to use, and see how it was defined.</P>
<H2 style="MARGIN: 10pt 0cm 0pt"><FONT color=#e36c0a size=4 face=Cambria>Tool support</FONT></H2>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal>Luckily, we don’t need to read TLBs in binary. There’s a tool included with the Windows SDK, called oleview.exe. Just pass the TLB as a command-line parameter and it will show the IDL. It will also allow passing EXE or DLL files, as long as they contain a TLB.</P>
<H2 style="MARGIN: 10pt 0cm 0pt"><FONT color=#e36c0a size=4 face=Cambria>Finding out what’s wrong</FONT></H2>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal>In our case, the relevant method looked like:</P>
<P style="MARGIN: 0cm 0cm 10pt; BACKGROUND: #eeece1; mso-background-themecolor: background2" class=MsoNormal><SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 9pt">[id(0x60020020)]<BR>HRESULT SetData([in] SAFEARRAY(_Data*) param);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal>More often than not, we don’t have an idea about why Visual Basic 6 doesn’t like a given construct. An easy way to tell this is to create a simple ActiveX project in Visual Basic 6 and define a method or type that resembles the construct on the .NET side the most. Then, compile the project, pass the DLL/EXE to oleview.exe and check out how Visual Basic 6 expressed what you wrote in IDL.</P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal>We did just the same, and what we saw was:</P>
<P style="MARGIN: 0cm 0cm 10pt; BACKGROUND: #eeece1; mso-background-themecolor: background2" class=MsoNormal><SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 9pt">[id(0x60030000)]<BR>HRESULT SetData([in, out] SAFEARRAY(_Data*)<SPAN style="BACKGROUND: yellow; mso-highlight: yellow">*</SPAN> param);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal>The difference was an additional level of indirection, highlighted above.</P>
<H2 style="MARGIN: 10pt 0cm 0pt"><FONT color=#e36c0a size=4 face=Cambria>System.Runtime.InteropServices.MarshalAsAttribute comes at the rescue</FONT></H2>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal>Since you have close to zero ways to customize things on the Visual Basic 6 size, you need to look at the managed code. Since now you know how the managed type or method should appear to COM consumers, you can change the .NET definition to accommodate this. Fortunately, this attribute allows to change the IDL (and the behavior of the .NET marshaler) without changing the .NET semantics. It goes far beyond the scope of this post to describe what this attribute can do, you can have a look at <A href="https://msdn.microsoft.com/en-us/library/system.runtime.interopservices.marshalasattribute.aspx" mce_href="https://msdn.microsoft.com/en-us/library/system.runtime.interopservices.marshalasattribute.aspx">MSDN</A>.</P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal>Sometimes, however, you do need to change .NET semantics, like in our case. Since we need an additional level of indirection, we need to pass the array by reference – thus use the ‘ref’ keyword:</P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 9pt; mso-bidi-font-size: 10.0pt">public</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 9pt; mso-bidi-font-size: 10.0pt"> <SPAN style="COLOR: blue">void</SPAN> SetData(<SPAN style="COLOR: blue">ref</SPAN> <SPAN style="COLOR: #2b91af">Data</SPAN>[] param)<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 9pt; mso-bidi-font-size: 10.0pt">{<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; TEXT-INDENT: 36pt; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 9pt; mso-bidi-font-size: 10.0pt">...<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; BACKGROUND: #eeece1" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 9pt; mso-bidi-font-size: 10.0pt">}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><o:p>&nbsp;</o:p></P>
<H2 style="MARGIN: 10pt 0cm 0pt"><FONT color=#e36c0a size=4 face=Cambria>Bonus tip</FONT></H2>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal>During this recent support case with my customer, we proceeded up to this point, but still Visual Basic 6 threw run-time errors when using the modified method. After a lot of trial and errors, we discovered that invoking the method as a procedure (i.e. without parentheses) was always successful, while the function-like invoking style (i.e. with parentheses) always failed. </P>
<P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal><SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Calibri','sans-serif'; FONT-SIZE: 11pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">Seasoned Visual Basic 6 developers may be able to explain this, I could not. If anyone has an idea, feel free to add it to comments.</SPAN></FONT></P>]]></content:encoded>
    </item>
  </channel>
</rss>