<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Sajay</title><link>http://blogs.msdn.com/sajay/default.aspx</link><description>&lt;a href="http://www.sajay.com/category/Microsoft.aspx"&gt; Crossposting from SAJAY.COM - Life, The Universe and Everything Distributed.&lt;/a&gt;</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>WCF Performance Counters</title><link>http://blogs.msdn.com/sajay/archive/2009/09/14/wcf-performance-counters.aspx</link><pubDate>Tue, 15 Sep 2009 09:50:38 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9895270</guid><dc:creator>Sajay</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/sajay/comments/9895270.aspx</comments><wfw:commentRss>http://blogs.msdn.com/sajay/commentrss.aspx?PostID=9895270</wfw:commentRss><description>&lt;b&gt;Note:&lt;/b&gt; Cross posted from &lt;a href="http://www.sajay.com"&gt;Sajay&lt;/a&gt;.
&lt;br /&gt;&lt;a href="http://www.sajay.com/post/2009/09/13/WCF-Performance-Counters.aspx"&gt;Permalink&lt;/a&gt;
&lt;br /&gt;&lt;p&gt;We generally need to have a quick set of &lt;a href="http://msdn.microsoft.com/en-us/library/ms735098.aspx"&gt;performance counters&lt;/a&gt; to identify a performance issue with a service. Shown below are three new counters that you will find with WCF 4.0. I also want to emphasize on the &lt;a href="http://msdn.microsoft.com/en-us/library/ms733055.aspx"&gt;Calls outstanding&lt;/a&gt; counter here since this is one very u&lt;/p&gt;  &lt;p&gt;   &lt;table style="width: 581px; border-collapse: collapse; mso-border-alt: solid #a6a6a6 .5pt; mso-border-themecolor: background1; mso-border-themeshade: 166; mso-yfti-tbllook: 1184; mso-padding-alt: 0in 5.75pt 0in 1.45pt; mso-border-insideh: .5pt solid #a6a6a6; mso-border-insideh-themecolor: background1; mso-border-insideh-themeshade: 166; mso-border-insidev: .5pt solid #a6a6a6; mso-border-insidev-themecolor: background1; mso-border-insidev-themeshade: 166" class="MsoTableGrid" border="1" cellspacing="0" cellpadding="0"&gt;&lt;tbody&gt;       &lt;tr style="height: 0.7pt; mso-yfti-irow: 0; mso-yfti-firstrow: yes"&gt;         &lt;td style="border-bottom: #a6a6a6 1pt solid; border-left: #a6a6a6 1pt solid; padding-bottom: 0in; background-color: transparent; padding-left: 1.45pt; width: 116.95pt; padding-right: 5.75pt; height: 0.7pt; border-top: #a6a6a6 1pt solid; border-right: #a6a6a6 1pt solid; padding-top: 0in; mso-border-alt: solid #a6a6a6 .5pt; mso-border-themecolor: background1; mso-border-themeshade: 166" valign="top" width="156"&gt;           &lt;p style="margin: 0in 0in 0pt" class="MsoNoSpacing"&gt;&lt;span style="font-size: 10pt; mso-bidi-font-size: 11.0pt"&gt;&lt;span style="font-family: calibri"&gt;PercentOfMaxCalls&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="border-bottom: #a6a6a6 1pt solid; padding-bottom: 0in; background-color: transparent; padding-left: 1.45pt; width: 123.5pt; padding-right: 5.75pt; height: 0.7pt; border-left-color: #f0f0f0; border-top: #a6a6a6 1pt solid; border-right: #a6a6a6 1pt solid; padding-top: 0in; mso-border-alt: solid #a6a6a6 .5pt; mso-border-themecolor: background1; mso-border-themeshade: 166; mso-border-left-alt: solid #a6a6a6 .5pt; mso-border-left-themecolor: background1; mso-border-left-themeshade: 166" valign="top" width="165"&gt;           &lt;p style="margin: 0in 0in 0pt" class="MsoNoSpacing"&gt;&lt;span style="font-size: 10pt; mso-bidi-font-size: 11.0pt"&gt;&lt;span style="font-family: calibri"&gt;Reports # of active requests as % of max calls&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="border-bottom: #a6a6a6 1pt solid; padding-bottom: 0in; background-color: transparent; padding-left: 1.45pt; width: 195.4pt; padding-right: 5.75pt; height: 0.7pt; border-left-color: #f0f0f0; border-top: #a6a6a6 1pt solid; border-right: #a6a6a6 1pt solid; padding-top: 0in; mso-border-alt: solid #a6a6a6 .5pt; mso-border-themecolor: background1; mso-border-themeshade: 166; mso-border-left-alt: solid #a6a6a6 .5pt; mso-border-left-themecolor: background1; mso-border-left-themeshade: 166" valign="top" width="261"&gt;           &lt;p style="margin: 0in 0in 0pt" class="MsoNoSpacing"&gt;&lt;span style="font-size: 10pt; mso-bidi-font-size: 11.0pt"&gt;&lt;span style="font-family: calibri"&gt;Reports the numbers of messages being processed + in the wait queue as a percentage of MaxConcurrentCalls throttle&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr style="height: 0.7pt; mso-yfti-irow: 1"&gt;         &lt;td style="border-bottom: #a6a6a6 1pt solid; border-left: #a6a6a6 1pt solid; padding-bottom: 0in; background-color: transparent; border-top-color: #f0f0f0; padding-left: 1.45pt; width: 116.95pt; padding-right: 5.75pt; height: 0.7pt; border-right: #a6a6a6 1pt solid; padding-top: 0in; mso-border-alt: solid #a6a6a6 .5pt; mso-border-themecolor: background1; mso-border-themeshade: 166; mso-border-top-alt: solid #a6a6a6 .5pt; mso-border-top-themecolor: background1; mso-border-top-themeshade: 166" valign="top" width="156"&gt;           &lt;p style="margin: 0in 0in 0pt" class="MsoNoSpacing"&gt;&lt;span style="font-size: 10pt; mso-bidi-font-size: 11.0pt"&gt;&lt;span style="font-family: calibri"&gt;PercentOfMaxSessions&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="border-bottom: #a6a6a6 1pt solid; padding-bottom: 0in; background-color: transparent; border-top-color: #f0f0f0; padding-left: 1.45pt; width: 123.5pt; padding-right: 5.75pt; height: 0.7pt; border-left-color: #f0f0f0; border-right: #a6a6a6 1pt solid; padding-top: 0in; mso-border-alt: solid #a6a6a6 .5pt; mso-border-themecolor: background1; mso-border-themeshade: 166; mso-border-left-alt: solid #a6a6a6 .5pt; mso-border-left-themecolor: background1; mso-border-left-themeshade: 166; mso-border-top-alt: solid #a6a6a6 .5pt; mso-border-top-themecolor: background1; mso-border-top-themeshade: 166; mso-border-bottom-themecolor: background1; mso-border-bottom-themeshade: 166; mso-border-right-themecolor: background1; mso-border-right-themeshade: 166" valign="top" width="165"&gt;           &lt;p style="margin: 0in 0in 0pt" class="MsoNoSpacing"&gt;&lt;span style="font-size: 10pt; mso-bidi-font-size: 11.0pt"&gt;&lt;span style="font-family: calibri"&gt;Reports # of active requests as % of max sessions&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="border-bottom: #a6a6a6 1pt solid; padding-bottom: 0in; background-color: transparent; border-top-color: #f0f0f0; padding-left: 1.45pt; width: 195.4pt; padding-right: 5.75pt; height: 0.7pt; border-left-color: #f0f0f0; border-right: #a6a6a6 1pt solid; padding-top: 0in; mso-border-alt: solid #a6a6a6 .5pt; mso-border-themecolor: background1; mso-border-themeshade: 166; mso-border-left-alt: solid #a6a6a6 .5pt; mso-border-left-themecolor: background1; mso-border-left-themeshade: 166; mso-border-top-alt: solid #a6a6a6 .5pt; mso-border-top-themecolor: background1; mso-border-top-themeshade: 166; mso-border-bottom-themecolor: background1; mso-border-bottom-themeshade: 166; mso-border-right-themecolor: background1; mso-border-right-themeshade: 166" valign="top" width="261"&gt;           &lt;p style="margin: 0in 0in 0pt" class="MsoNoSpacing"&gt;&lt;span style="font-size: 10pt; mso-bidi-font-size: 11.0pt"&gt;&lt;span style="font-family: calibri"&gt;Reports the numbers of active instances + calls in the wait queue waiting for an instance as a percentage of MaxConcurrentInstances throttle&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr style="height: 0.7pt; mso-yfti-irow: 2"&gt;         &lt;td style="border-bottom: #a6a6a6 1pt solid; border-left: #a6a6a6 1pt solid; padding-bottom: 0in; background-color: transparent; border-top-color: #f0f0f0; padding-left: 1.45pt; width: 116.95pt; padding-right: 5.75pt; height: 0.7pt; border-right: #a6a6a6 1pt solid; padding-top: 0in; mso-border-alt: solid #a6a6a6 .5pt; mso-border-themecolor: background1; mso-border-themeshade: 166; mso-border-top-alt: solid #a6a6a6 .5pt; mso-border-top-themecolor: background1; mso-border-top-themeshade: 166" valign="top" width="156"&gt;           &lt;p style="margin: 0in 0in 0pt" class="MsoNoSpacing"&gt;&lt;span style="font-size: 10pt; mso-bidi-font-size: 11.0pt"&gt;&lt;span style="font-family: calibri"&gt;PercentOfMaxInstances&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="border-bottom: #a6a6a6 1pt solid; padding-bottom: 0in; background-color: transparent; border-top-color: #f0f0f0; padding-left: 1.45pt; width: 123.5pt; padding-right: 5.75pt; height: 0.7pt; border-left-color: #f0f0f0; border-right: #a6a6a6 1pt solid; padding-top: 0in; mso-border-alt: solid #a6a6a6 .5pt; mso-border-themecolor: background1; mso-border-themeshade: 166; mso-border-left-alt: solid #a6a6a6 .5pt; mso-border-left-themecolor: background1; mso-border-left-themeshade: 166; mso-border-top-alt: solid #a6a6a6 .5pt; mso-border-top-themecolor: background1; mso-border-top-themeshade: 166; mso-border-bottom-themecolor: background1; mso-border-bottom-themeshade: 166; mso-border-right-themecolor: background1; mso-border-right-themeshade: 166" valign="top" width="165"&gt;           &lt;p style="margin: 0in 0in 0pt" class="MsoNoSpacing"&gt;&lt;span style="font-size: 10pt; mso-bidi-font-size: 11.0pt"&gt;&lt;span style="font-family: calibri"&gt;Reports # of active requests as % of max instances&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="border-bottom: #a6a6a6 1pt solid; padding-bottom: 0in; background-color: transparent; border-top-color: #f0f0f0; padding-left: 1.45pt; width: 195.4pt; padding-right: 5.75pt; height: 0.7pt; border-left-color: #f0f0f0; border-right: #a6a6a6 1pt solid; padding-top: 0in; mso-border-alt: solid #a6a6a6 .5pt; mso-border-themecolor: background1; mso-border-themeshade: 166; mso-border-left-alt: solid #a6a6a6 .5pt; mso-border-left-themecolor: background1; mso-border-left-themeshade: 166; mso-border-top-alt: solid #a6a6a6 .5pt; mso-border-top-themecolor: background1; mso-border-top-themeshade: 166; mso-border-bottom-themecolor: background1; mso-border-bottom-themeshade: 166; mso-border-right-themecolor: background1; mso-border-right-themeshade: 166" valign="top" width="261"&gt;           &lt;p style="margin: 0in 0in 0pt" class="MsoNoSpacing"&gt;&lt;span style="font-size: 10pt; mso-bidi-font-size: 11.0pt"&gt;&lt;span style="font-family: calibri"&gt;Reports the numbers of messages in the wait queue due to MaxConcurrentSessions throttle&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr style="height: 0.7pt; mso-yfti-irow: 3; mso-yfti-lastrow: yes"&gt;         &lt;td style="border-bottom: #a6a6a6 1pt solid; border-left: #a6a6a6 1pt solid; padding-bottom: 0in; background-color: transparent; border-top-color: #f0f0f0; padding-left: 1.45pt; width: 116.95pt; padding-right: 5.75pt; height: 0.7pt; border-right: #a6a6a6 1pt solid; padding-top: 0in; mso-border-alt: solid #a6a6a6 .5pt; mso-border-themecolor: background1; mso-border-themeshade: 166; mso-border-top-alt: solid #a6a6a6 .5pt; mso-border-top-themecolor: background1; mso-border-top-themeshade: 166" valign="top" width="156"&gt;           &lt;p style="margin: 0in 0in 0pt" class="MsoNoSpacing"&gt;&lt;span style="font-size: 10pt; mso-bidi-font-size: 11.0pt"&gt;&lt;span style="font-family: calibri"&gt;CallsOutstanding ( from 3.0)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="border-bottom: #a6a6a6 1pt solid; padding-bottom: 0in; background-color: transparent; border-top-color: #f0f0f0; padding-left: 1.45pt; width: 123.5pt; padding-right: 5.75pt; height: 0.7pt; border-left-color: #f0f0f0; border-right: #a6a6a6 1pt solid; padding-top: 0in; mso-border-alt: solid #a6a6a6 .5pt; mso-border-themecolor: background1; mso-border-themeshade: 166; mso-border-left-alt: solid #a6a6a6 .5pt; mso-border-left-themecolor: background1; mso-border-left-themeshade: 166; mso-border-top-alt: solid #a6a6a6 .5pt; mso-border-top-themecolor: background1; mso-border-top-themeshade: 166; mso-border-bottom-themecolor: background1; mso-border-bottom-themeshade: 166; mso-border-right-themecolor: background1; mso-border-right-themeshade: 166" valign="top" width="165"&gt;           &lt;p style="margin: 0in 0in 0pt" class="MsoNoSpacing"&gt;&lt;span style="font-size: 10pt; mso-bidi-font-size: 11.0pt"&gt;&lt;span style="font-family: calibri"&gt;Reports the # of calls waiting to be completed&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td style="border-bottom: #a6a6a6 1pt solid; padding-bottom: 0in; background-color: transparent; border-top-color: #f0f0f0; padding-left: 1.45pt; width: 195.4pt; padding-right: 5.75pt; height: 0.7pt; border-left-color: #f0f0f0; border-right: #a6a6a6 1pt solid; padding-top: 0in; mso-border-alt: solid #a6a6a6 .5pt; mso-border-themecolor: background1; mso-border-themeshade: 166; mso-border-left-alt: solid #a6a6a6 .5pt; mso-border-left-themecolor: background1; mso-border-left-themeshade: 166; mso-border-top-alt: solid #a6a6a6 .5pt; mso-border-top-themecolor: background1; mso-border-top-themeshade: 166; mso-border-bottom-themecolor: background1; mso-border-bottom-themeshade: 166; mso-border-right-themecolor: background1; mso-border-right-themeshade: 166" valign="top" width="261"&gt;           &lt;p style="margin: 0in 0in 0pt" class="MsoNoSpacing"&gt;&lt;span style="font-size: 10pt; mso-bidi-font-size: 11.0pt"&gt;&lt;span style="font-family: calibri"&gt;Reports the number of in-progress calls to this service.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/p&gt;  &lt;p&gt;Here you see that the %Instance throttle has maxed out. What do you think we should do? You can guess what throttle we are hitting here.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.sajay.com/image.axd?picture=image_7.png"&gt;&lt;img border="0" alt="" src="http://www.sajay.com/image.axd?picture=image_thumb_6.png" /&gt;&lt;/a&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.sajay.com/image.axd?picture=image_8.png"&gt;&lt;img border="0" alt="" src="http://www.sajay.com/image.axd?picture=image_thumb_7.png" /&gt;&lt;/a&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Some common questions when trouble shooting performance problems:&lt;/p&gt;  &lt;h3&gt;Why are my clients timing out, the service is showing 100% for % of MaxConcurrentCalls?&lt;/h3&gt;  &lt;p&gt;% of MaxConcurrentCalls gives you an indication of how much closer you are to hitting your &lt;a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.description.servicethrottlingbehavior.maxconcurrentcalls.aspx"&gt;max throttle value&lt;/a&gt;. This means that if you have a max concurrent call of 10 and you have 10 outstanding calls then you have utilized 100% of your throttle and there is no more work that your service can do. So if you see that your % maxConcurrentCalls is very high it probably indicates you have a very low throttle value. Remember the &lt;a href="http://www.sajay.com/post/2009/07/17/ServiceThrottlingBehavior-defaults-for-NET-4.aspx"&gt;default is 16 till v3.5 and 16* proc count for v4.0&lt;/a&gt;.&amp;#160; Before 4.0 you needed to work this out by checking the calls outstanding throttle and your web.config to figure out this value. These new % performance counters would help you identify if you are hitting the max values from now.&lt;/p&gt;  &lt;h3&gt;What if % MaxConcurrentSessions is showing 100% ?&lt;/h3&gt;  &lt;p&gt;We have bumped up the default number of sessions for service throttling behavior to 100 per CPU. But then again if you are seeing that %MaxConcurrentSessions is very high&amp;#160; this means that you have exhausted all your session. This is probably because your clients are not closing either proxies and terminating sessions when you have less clients or possibly due to a very small MaxConcurrentSessions configuration.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9895270" width="1" height="1"&gt;</description></item><item><title>How do I get the Message Body as an XElement?</title><link>http://blogs.msdn.com/sajay/archive/2009/09/02/how-do-i-get-the-message-body-as-an-xelement.aspx</link><pubDate>Thu, 03 Sep 2009 08:41:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9890747</guid><dc:creator>Sajay</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/sajay/comments/9890747.aspx</comments><wfw:commentRss>http://blogs.msdn.com/sajay/commentrss.aspx?PostID=9890747</wfw:commentRss><description>&lt;b&gt;Note:&lt;/b&gt; Cross posted from &lt;a href="http://www.sajay.com"&gt;Sajay&lt;/a&gt;.
&lt;br /&gt;&lt;a href="http://www.sajay.com/post/2009/09/02/How-do-I-get-the-Message-Body-as-an-XElement.aspx"&gt;Permalink&lt;/a&gt;
&lt;br /&gt;&lt;p&gt;This was one was interesting as the service was exposed as a fully typed service, but the client wanted to modify some parts of the xml. Ideally you can plug into any part to perform these operations, but the general requirement here was that they needed a simple pointer to the Body and didn't care much about anything else. &lt;/p&gt;  &lt;p&gt;For example you can get the XElement from the body using a simple operation and use the Message object on the client to get a pointer to the body.&lt;/p&gt; [code:c#]   &lt;pre&gt;[ServiceContract(Namespace=&amp;quot;http://www.sajay.com/&amp;quot;)]
public interface IClientProxy
{
    [OperationContract(Action=&amp;quot;http://www.sajay.com/getdata&amp;quot;,
        ReplyAction=&amp;quot;http://www.sajay.com/getdataresponse&amp;quot;)]        
    Message DoWork();        
}
   
IClientProxy proxy = cf.CreateChannel();
Message msg = proxy.DoWork();                                    
XNode node = XElement.ReadFrom(msg.GetReaderAtBodyContents());&lt;/pre&gt;

&lt;p&gt;[/code] &lt;/p&gt;

&lt;p&gt;So the service can return a typed object, but the client doesn't have to handle the message in the same way. Understanding the Message class here helps you appreciate how the serializer and encoder is decoupled from the message representation. Basically WCF does not constrain the native format of your message on either the producer's or the consumer's side. It merely conforms to some rules of invoking a set of abstract classes classes which you wire up by virtue of specifying the encoder and the serializer. The fact that we have XML semantics around with abstract classes like the XmlReader/XmlDictionaryWriter etc doesn't actually mean that WCF converts everything to XML before it can process the message. It merely uses these to invoke the required parts to obtain things like the header/body and other properties.&amp;#160; The Message however can be represented natively in any form like binary/json/atom/ or any whacky type as long as you wire them up properly and can retrieve them in some manner. &lt;/p&gt;

&lt;p&gt;This should give you some insight into how much more powerful the message model is compared to simple RPC style contracts. &lt;a title="http://msdn.microsoft.com/en-us/library/ms734675.aspx" href="http://msdn.microsoft.com/en-us/library/ms734675.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms734675.aspx&lt;/a&gt; With 4.0 and workflow services, you will see this becoming more and more the default way of thinking about messages and services.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9890747" width="1" height="1"&gt;</description></item><item><title>HTTP polling duplex - Performance</title><link>http://blogs.msdn.com/sajay/archive/2009/08/28/http-polling-duplex-performance.aspx</link><pubDate>Fri, 28 Aug 2009 18:41:42 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9888556</guid><dc:creator>Sajay</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/sajay/comments/9888556.aspx</comments><wfw:commentRss>http://blogs.msdn.com/sajay/commentrss.aspx?PostID=9888556</wfw:commentRss><description>&lt;b&gt;Note:&lt;/b&gt; Cross posted from &lt;a href="http://www.sajay.com"&gt;Sajay&lt;/a&gt;.
&lt;br /&gt;&lt;a href="http://www.sajay.com/post/2009/08/28/HTTP-polling-duplex-Performance.aspx"&gt;Permalink&lt;/a&gt;
&lt;br /&gt;&lt;p&gt;Really good article on Performance of HTTP polling duplex server-side channel in Microsoft Silverlight 3 by Tomek from the ServiceModel/SL team.&lt;/p&gt;  &lt;p&gt;&lt;a title="http://tomasz.janczuk.org/2009/08/performance-of-http-polling-duplex.html" href="http://tomasz.janczuk.org/2009/08/performance-of-http-polling-duplex.html"&gt;http://tomasz.janczuk.org/2009/08/performance-of-http-polling-duplex.html&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9888556" width="1" height="1"&gt;</description></item><item><title>Applying behaviors on the client channel</title><link>http://blogs.msdn.com/sajay/archive/2009/08/28/applying-behaviors-on-the-client-channel.aspx</link><pubDate>Fri, 28 Aug 2009 10:58:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9888074</guid><dc:creator>Sajay</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/sajay/comments/9888074.aspx</comments><wfw:commentRss>http://blogs.msdn.com/sajay/commentrss.aspx?PostID=9888074</wfw:commentRss><description>&lt;B&gt;Note:&lt;/B&gt; Cross posted from &lt;A href="http://www.sajay.com/" mce_href="http://www.sajay.com"&gt;Sajay&lt;/A&gt;. &lt;BR&gt;&lt;A href="http://www.sajay.com/post/2009/08/28/Applying-behaviors-on-the-client-channel.aspx" mce_href="http://www.sajay.com/post/2009/08/28/Applying-behaviors-on-the-client-channel.aspx"&gt;Permalink&lt;/A&gt; &lt;BR&gt;
&lt;P&gt;When we need to modify or see the message before its sent or after its received, we generally can use a Message inspector. However sometimes we want to be a bit more granular. One such requirement was to perform some operations for 2-way calls and a different set of operations for one way calls. For this you can probably use extensibility points like the IParameterInspector and attach the required inspector to those appropriate operations. &lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
{
    foreach (ClientOperation operation in clientRuntime.Operations)
    {
        if (!operation.IsOneWay)
        {
            operation.ParameterInspectors.Add(new TwoWayBehavior());
        }
        else
        {
            operation.ParameterInspectors.Add(new OneWayBehavior());
        }
    }
}&lt;/PRE&gt;
&lt;P&gt;&lt;A href="http://www.sajay.com/file.axd?file=2009%2f8%2fProgram.cs"&gt;Here is the source.(3.13 kb)&lt;/A&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9888074" width="1" height="1"&gt;</description></item><item><title>WCF 4: AddDefaultEndpoints</title><link>http://blogs.msdn.com/sajay/archive/2009/08/17/wcf-4-adddefaultendpoints.aspx</link><pubDate>Tue, 18 Aug 2009 03:38:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9873247</guid><dc:creator>Sajay</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/sajay/comments/9873247.aspx</comments><wfw:commentRss>http://blogs.msdn.com/sajay/commentrss.aspx?PostID=9873247</wfw:commentRss><description>&lt;B&gt;Note:&lt;/B&gt; Cross posted from &lt;A href="http://www.sajay.com/" mce_href="http://www.sajay.com"&gt;Sajay&lt;/A&gt;. &lt;BR&gt;&lt;A href="http://www.sajay.com/post/2009/08/17/WCF-4-AddDefaultEndpoints.aspx" mce_href="http://www.sajay.com/post/2009/08/17/WCF-4-AddDefaultEndpoints.aspx"&gt;Permalink&lt;/A&gt; &lt;BR&gt;
&lt;P&gt;Here is another little goodie we have which will help in reducing configuration. You can use the &lt;A href="http://msdn.microsoft.com/en-us/library/system.servicemodel.servicehostbase.adddefaultendpoints(VS.100).aspx" mce_href="http://msdn.microsoft.com/en-us/library/system.servicemodel.servicehostbase.adddefaultendpoints(VS.100).aspx"&gt;ServiceHostBase.AddDefaultEndpoints&lt;/A&gt; which will pretty much probe your service implementation for contracts and expose them as shown below. Notice that I don't need to specify anything more than the base address and the type of the service and I have actually commented out the call to the API. You can find more details about the &lt;A href="http://msdn.microsoft.com/en-us/library/ee354381.aspx#_Simplified_Configuration"&gt;&lt;FONT color=#909090&gt;simplified configuration here&lt;/FONT&gt;&lt;/A&gt;. &lt;/P&gt;&lt;PRE&gt;const string address = "net.tcp://localhost:8080/";
const string address2 = "http://localhost:8081/";
ServiceHost host = new ServiceHost(typeof(Service1), new Uri(address), new Uri(address2));
&lt;STRONG&gt;//host.AddDefaultEndpoints(); &lt;/STRONG&gt;
host.Open();
&lt;PRE&gt;&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sajay.com/image.axd?picture=image_5.png" mce_href="http://www.sajay.com/image.axd?picture=image_5.png"&gt;&lt;IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title=AddDefaultEndpoints border=0 alt=AddDefaultEndpoints src="http://www.sajay.com/image.axd?picture=image_thumb_4.png" width=681 height=202 mce_src="http://www.sajay.com/image.axd?picture=image_thumb_4.png"&gt;&lt;/A&gt; &lt;/P&gt;&lt;/PRE&gt;&lt;/PRE&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9873247" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/sajay/archive/tags/WS-_2A00_+and+WCF/default.aspx">WS-* and WCF</category></item><item><title>How do I get the workflow InstanceId?</title><link>http://blogs.msdn.com/sajay/archive/2009/08/14/how-do-i-get-the-workflow-instanceid.aspx</link><pubDate>Sat, 15 Aug 2009 05:43:09 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9870749</guid><dc:creator>Sajay</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/sajay/comments/9870749.aspx</comments><wfw:commentRss>http://blogs.msdn.com/sajay/commentrss.aspx?PostID=9870749</wfw:commentRss><description>&lt;b&gt;Note:&lt;/b&gt; Cross posted from &lt;a href="http://www.sajay.com"&gt;Sajay&lt;/a&gt;. &lt;br&gt;&lt;a href="http://www.sajay.com/post/2009/08/14/How-do-I-get-the-workflow-InstanceID.aspx"&gt;Permalink&lt;/a&gt; &lt;br&gt; &lt;p&gt;You can use a &lt;a href="http://msdn.microsoft.com/en-us/library/dd465967(VS.100).aspx"&gt;CodeActivity that returns a single result&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;pre&gt;    public sealed class GetWorkflowInstanceId : CodeActivity&amp;lt;Guid&amp;gt;
    {
        protected override Guid Execute(CodeActivityContext context)
        {
            return context.WorkflowInstanceId;
        }
    }&lt;/pre&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9870749" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/sajay/archive/tags/WF/default.aspx">WF</category></item><item><title>Hello World Workflow Service 4.0</title><link>http://blogs.msdn.com/sajay/archive/2009/08/13/hello-world-workflow-service-4-0.aspx</link><pubDate>Fri, 14 Aug 2009 07:53:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9869351</guid><dc:creator>Sajay</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/sajay/comments/9869351.aspx</comments><wfw:commentRss>http://blogs.msdn.com/sajay/commentrss.aspx?PostID=9869351</wfw:commentRss><description>&lt;b&gt;Note:&lt;/b&gt; Cross posted from &lt;a href="http://www.sajay.com/" mce_href="http://www.sajay.com"&gt;Sajay&lt;/a&gt;. &lt;br&gt;&lt;a href="http://www.sajay.com/post/2009/08/13/Hello-World-Workflow-Service-40.aspx" mce_href="http://www.sajay.com/post/2009/08/13/Hello-World-Workflow-Service-40.aspx"&gt;Permalink&lt;/a&gt; &lt;br&gt; &lt;p&gt;Building a workflow service using 4.0 gives a very neat set of capabilities from both WF and WCF. Similar to WCF we can fully define a workflow either in code or otherwise just using Xaml. Here I chose a fully code based approach. If you just want the source you can &lt;a href="http://blogs.msdn.com/sajay/attachment/9869351.ashx"&gt;download it here&lt;/a&gt;.&lt;/p&gt; &lt;h2&gt;The Service Contract &lt;/h2&gt; &lt;p&gt;We generally can take a workflow first approach or a contract first. To keep things simple, I have a very bare service contract as shown below. &lt;/p&gt; &lt;div&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;/div&gt; &lt;div&gt; &lt;table style="border-collapse: collapse; background: whitesmoke" border="0"&gt; &lt;colgroup&gt; &lt;col style="width: 639px"&gt;&lt;/colgroup&gt; &lt;tbody valign="top"&gt; &lt;tr style="height: 54px"&gt; &lt;td style="border-bottom: #bfbfbf 0.5pt solid; border-left: #bfbfbf 0.5pt solid; padding-bottom: 8px; padding-left: 8px; padding-right: 8px; border-top: #bfbfbf 0.5pt solid; border-right: #bfbfbf 0.5pt solid; padding-top: 8px"&gt; &lt;p&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;[&lt;span style="color: #2b91af"&gt;ServiceContract&lt;/span&gt;] &lt;br&gt;&lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;interface&lt;/span&gt; &lt;span style="color: #2b91af"&gt;IService1&lt;/span&gt; &lt;br&gt;&lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;{ &lt;br&gt;&lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [&lt;span style="color: #2b91af"&gt;OperationContract&lt;/span&gt;] &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;void&lt;/span&gt; GetData(); &lt;br&gt;&lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;}&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt; &lt;p&gt;I also hold on to the contract description. This is just convenience and to avoid some constants like service name etc. &lt;/p&gt; &lt;div&gt; &lt;table style="border-collapse: collapse; background: whitesmoke" border="0"&gt; &lt;colgroup&gt; &lt;col style="width: 639px"&gt;&lt;/colgroup&gt; &lt;tbody valign="top"&gt; &lt;tr style="height: 24px"&gt; &lt;td style="border-bottom: #bfbfbf 0.5pt solid; border-left: #bfbfbf 0.5pt solid; padding-bottom: 8px; padding-left: 8px; padding-right: 8px; border-top: #bfbfbf 0.5pt solid; border-right: #bfbfbf 0.5pt solid; padding-top: 8px" valign="center"&gt; &lt;p&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #2b91af"&gt;ContractDescription&lt;/span&gt; description = &lt;span style="color: #2b91af"&gt;ContractDescription&lt;/span&gt;.GetContract(&lt;span style="color: blue"&gt;typeof&lt;/span&gt;(&lt;span style="color: #2b91af"&gt;IService1&lt;/span&gt;));&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt; &lt;h2&gt;The Operation &lt;/h2&gt; &lt;p&gt;The idea here is to build the service bottom up from operation we need to perform. I can think of my workflow as composition of activities. The functionality of my service is quite simple here. All I do is write a message to the console. So the body of my operation will look something like this. &lt;/p&gt; &lt;div&gt; &lt;table style="border-collapse: collapse; background: whitesmoke" border="0"&gt; &lt;colgroup&gt; &lt;col style="width: 638px"&gt;&lt;/colgroup&gt; &lt;tbody valign="top"&gt; &lt;tr style="height: 89px"&gt; &lt;td style="border-bottom: #bfbfbf 0.5pt solid; border-left: #bfbfbf 0.5pt solid; padding-left: 7px; padding-right: 7px; border-top: #bfbfbf 0.5pt solid; border-right: #bfbfbf 0.5pt solid" valign="center"&gt; &lt;p&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;WriteLine&lt;/span&gt; &lt;br&gt;&lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;{&amp;nbsp; &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;TextWriter = &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.Out, &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;Text =&lt;span style="color: #a31515"&gt;"Hello Workflow."&lt;/span&gt; &lt;br&gt;&lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;},&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt; &lt;h2&gt;The Implementation &lt;/h2&gt; &lt;p&gt;Now I need to make this an operation. An operation has an associated message exchange pattern, commonly referred to as MEP. In my case it's a simple receive reply pattern. This means I have to compose my work in between a Receive and a SendReply. I am also going to tie this all up in Sequence as shown below. &lt;/p&gt; &lt;div&gt; &lt;table style="border-collapse: collapse; background: whitesmoke" border="0"&gt; &lt;colgroup&gt; &lt;col style="width: 638px"&gt;&lt;/colgroup&gt; &lt;tbody valign="top"&gt; &lt;tr style="height: 203px"&gt; &lt;td style="border-bottom: #bfbfbf 0.5pt solid; border-left: #bfbfbf 0.5pt solid; padding-left: 7px; padding-right: 7px; border-top: #bfbfbf 0.5pt solid; border-right: #bfbfbf 0.5pt solid" valign="center"&gt; &lt;p&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #2b91af"&gt;Sequence&lt;/span&gt; sequence = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Sequence&lt;/span&gt; &lt;br&gt;&lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;{ &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;Activities = &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;{ &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;receive, &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;WriteLine&lt;/span&gt;&amp;nbsp; &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;{ &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;TextWriter = &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.Out, &lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;Text =&lt;span style="color: #a31515"&gt;"Hello Workflow."&lt;/span&gt; &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;}, &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;reply &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;} &lt;br&gt;&lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;};&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt; &lt;h2&gt;The Message Exchange &lt;/h2&gt; &lt;p&gt;The next thing is to lay out my Receive and Reply which will define the wire format of the messages. &lt;/p&gt; &lt;ol&gt; &lt;li&gt;The receive needs to know the operation that the client can invoke. Also I need to make sure that the workflow can be instantiated by this particular operation. For this I need to set the CanCreateInstance property. Also the serializer used by default is the DataContractSerializer. &lt;/li&gt;&lt;/ol&gt; &lt;div&gt; &lt;table style="border-collapse: collapse; background: whitesmoke" border="0"&gt; &lt;colgroup&gt; &lt;col style="width: 638px"&gt;&lt;/colgroup&gt; &lt;tbody valign="top"&gt; &lt;tr style="height: 86px"&gt; &lt;td style="border-bottom: #bfbfbf 0.5pt solid; border-left: #bfbfbf 0.5pt solid; padding-left: 7px; padding-right: 7px; border-top: #bfbfbf 0.5pt solid; border-right: #bfbfbf 0.5pt solid" valign="center"&gt; &lt;p&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #2b91af"&gt;Receive&lt;/span&gt; receive = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Receive&lt;/span&gt; &lt;br&gt;&lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;{ &lt;br&gt;&lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OperationName = description.Operations[0].Name,&amp;nbsp; &lt;br&gt;&lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CanCreateInstance = &lt;span style="color: blue"&gt;true&lt;/span&gt; &lt;br&gt;&lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;};&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt; &lt;ul&gt; &lt;li&gt;The Reply is send back to the client using my SendReply activity. This reply is a part of a conversation and it needs to know which request it would respond to. I can do this by pointing the SendReply to the instance of the corresponding Receive. Also I don't have any data here so it is an empty parameter list. (the operation is not Messages contract based in my case but this is generally a better option for more control and performance.) &lt;/li&gt;&lt;/ul&gt; &lt;div&gt; &lt;table style="border-collapse: collapse; background: whitesmoke" border="0"&gt; &lt;colgroup&gt; &lt;col style="width: 638px"&gt;&lt;/colgroup&gt; &lt;tbody valign="top"&gt; &lt;tr style="height: 91px"&gt; &lt;td style="border-bottom: #bfbfbf 0.5pt solid; border-left: #bfbfbf 0.5pt solid; padding-left: 7px; padding-right: 7px; border-top: #bfbfbf 0.5pt solid; border-right: #bfbfbf 0.5pt solid" valign="center"&gt; &lt;p&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #2b91af"&gt;SendReply&lt;/span&gt; reply = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;SendReply&lt;/span&gt; &lt;br&gt;&lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;{&amp;nbsp; &lt;br&gt;&lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;Request = receive,&amp;nbsp; &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;Content = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;SendParametersContent&lt;/span&gt; { } &lt;br&gt;&lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;};&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt; &lt;ul&gt; &lt;li&gt;I now need to define the workflow service which would hold this Sequence and also need to specify the full name of the service definition. For this I can use the description object to get the name, namespace etc. &lt;/li&gt;&lt;/ul&gt; &lt;div&gt; &lt;table style="border-collapse: collapse; background: whitesmoke" border="0"&gt; &lt;colgroup&gt; &lt;col style="width: 638px"&gt;&lt;/colgroup&gt; &lt;tbody valign="top"&gt; &lt;tr style="height: 88px"&gt; &lt;td style="border-bottom: #bfbfbf 0.5pt solid; border-left: #bfbfbf 0.5pt solid; padding-left: 7px; padding-right: 7px; border-top: #bfbfbf 0.5pt solid; border-right: #bfbfbf 0.5pt solid" valign="center"&gt; &lt;p&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #2b91af"&gt;WorkflowService&lt;/span&gt; serviceDefinition = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;WorkflowService&lt;/span&gt; &lt;br&gt;&lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;{ &lt;br&gt;&lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Body = sequence, &lt;br&gt;&lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Name = &lt;span style="color: #2b91af"&gt;XName&lt;/span&gt;.Get(description.Name, description.Namespace) &lt;br&gt;&lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;};&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt; &lt;h2&gt;The Host &lt;/h2&gt; &lt;p&gt;The next step is to give this definition to the workflow service host so that it can start the service. Here I self host the workflow as shown below. &lt;/p&gt; &lt;div&gt; &lt;table style="border-collapse: collapse; background: whitesmoke" border="0"&gt; &lt;colgroup&gt; &lt;col style="width: 642px"&gt;&lt;/colgroup&gt; &lt;tbody valign="top"&gt; &lt;tr style="height: 76px"&gt; &lt;td style="border-bottom: #bfbfbf 0.5pt solid; border-left: #bfbfbf 0.5pt solid; padding-left: 7px; padding-right: 7px; border-top: #bfbfbf 0.5pt solid; border-right: #bfbfbf 0.5pt solid" valign="center"&gt; &lt;p&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #2b91af"&gt;WorkflowServiceHost&lt;/span&gt; host = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;WorkflowServiceHost&lt;/span&gt;(serviceDefinition,&amp;nbsp; &lt;br&gt;&lt;/span&gt;&lt;span&gt;&lt;span style="color: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Uri&lt;/span&gt;(&lt;span style="color: #a31515"&gt;"http://localhost:8080"&lt;/span&gt;)); &lt;br&gt;host.AddServiceEndpoint(serviceDefinition.Name, &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;BasicHttpBinding&lt;/span&gt;(), &lt;span style="color: #a31515"&gt;""&lt;/span&gt;); &lt;br&gt;&lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;host.Open();&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt; &lt;h2&gt;The Test &lt;/h2&gt; &lt;p&gt;Finally I can test the workflow using a simple proxy. &lt;/p&gt; &lt;div&gt; &lt;table style="border-collapse: collapse; background: whitesmoke" border="0"&gt; &lt;colgroup&gt; &lt;col style="width: 642px"&gt;&lt;/colgroup&gt; &lt;tbody valign="top"&gt; &lt;tr style="height: 86px"&gt; &lt;td style="border-bottom: #bfbfbf 0.5pt solid; border-left: #bfbfbf 0.5pt solid; padding-left: 7px; padding-right: 7px; border-top: #bfbfbf 0.5pt solid; border-right: #bfbfbf 0.5pt solid" valign="center"&gt; &lt;p&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #2b91af"&gt;ChannelFactory&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;IService1&lt;/span&gt;&amp;gt; cf = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;ChannelFactory&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;IService1&lt;/span&gt;&amp;gt;(&lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;BasicHttpBinding&lt;/span&gt;(), &lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;&lt;span style="color: #a31515"&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "http://localhost:8080"&lt;/span&gt;); &lt;br&gt;&lt;/span&gt;&lt;span&gt;&lt;span style="color: #2b91af"&gt;IService1&lt;/span&gt; proxy = cf.CreateChannel(); &lt;br&gt;proxy.GetData(); &lt;br&gt;&lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9pt"&gt;((&lt;span style="color: #2b91af"&gt;IChannel&lt;/span&gt;)proxy).Close();&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9869351" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/sajay/attachment/9869351.ashx" length="2253" type="text/plain" /></item><item><title>Channel9: Monitoring WF Services</title><link>http://blogs.msdn.com/sajay/archive/2009/08/04/channel9-monitoring-wf-services.aspx</link><pubDate>Wed, 05 Aug 2009 00:27:56 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9857455</guid><dc:creator>Sajay</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/sajay/comments/9857455.aspx</comments><wfw:commentRss>http://blogs.msdn.com/sajay/commentrss.aspx?PostID=9857455</wfw:commentRss><description>&lt;b&gt;Note:&lt;/b&gt; Cross posted from &lt;a href="http://www.sajay.com"&gt;Sajay&lt;/a&gt;. &lt;br&gt;&lt;a href="http://www.sajay.com/post/2009/08/04/Channel9-Monitoring-WF-Services.aspx"&gt;Permalink&lt;/a&gt; &lt;br&gt; &lt;p&gt;&amp;nbsp; &lt;b&gt;&lt;a href="http://channel9.msdn.com/shows/10-4/10-4-Episode-24-Monitoring-Workflow-Services/"&gt;10-4 Episode 24: Monitoring Workflow Services&lt;/a&gt;&lt;/b&gt; &lt;/p&gt; &lt;p&gt;by Ron Jacobs - &lt;/p&gt; &lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;One of the great advantages to building services with WCF and Windows Workflow 4 is that the environment is instrumented with loads of events that allow you to track what exactly is happening.&amp;nbsp; This is useful for health monitoring, troubleshooting and other scenarios like auditing and compliance.&amp;nbsp; In this episode I'll take you through the monitoring lab from the Visual Studio 2010 training kit and show you how you can take advantage of these powerful capabilities. &lt;/p&gt;&lt;/blockquote&gt;&lt;object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="320" height="240"&gt; &lt;param name="source" value="http://channel9.msdn.com/App_Themes/default/vp09_06_22.xap" /&gt; &lt;param name="initParams" value="m=mms://mschnlnine.vo.llnwd.net/d1/ch9/5/0/6/4/7/4/104MonitoringWorkflowServicesNewNewNewNewNewNewNew_2MB_ch9.wmv,autostart=false,autohide=true,showembed=true, thumbnail=http://mschnlnine.vo.llnwd.net/d1/ch9/5/0/6/4/7/4/104MonitoringWorkflowServicesNewNewNewNewNewNewNew_large_ch9.png, postid=474605" /&gt; &lt;param name="background" value="#00FFFFFF" /&gt; &lt;a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;"&gt; &lt;img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none" /&gt; &lt;/a&gt; &lt;/object&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9857455" width="1" height="1"&gt;</description></item><item><title>Concurrent Receives - MaxPendingReceives</title><link>http://blogs.msdn.com/sajay/archive/2009/08/03/concurrent-receives-maxpendingreceive.aspx</link><pubDate>Tue, 04 Aug 2009 01:15:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9856569</guid><dc:creator>Sajay</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/sajay/comments/9856569.aspx</comments><wfw:commentRss>http://blogs.msdn.com/sajay/commentrss.aspx?PostID=9856569</wfw:commentRss><description>&lt;b&gt;Note:&lt;/b&gt; Cross posted from &lt;a href="http://www.sajay.com"&gt;Sajay&lt;/a&gt;. &lt;br&gt;&lt;a href="http://www.sajay.com/post/2009/08/03/Concurrent-Receives-MaxPendingReceive.aspx"&gt;Permalink&lt;/a&gt; &lt;br&gt; &lt;p&gt;One of the performance improvements we did with WCF 4.0 was to enable concurrent receives. This greatly helps scenarios where we need to do some kind of work like DB authentication with username passwords or custom channels that may need to log something. Primarily if any path during message receive requires some concurrency, then this is the knob you need to consider.&lt;/p&gt; &lt;p&gt;Here are some common &lt;a href="http://www.sajay.com/page/Concurrent-Receives-MaxPendingReceive-QA.aspx"&gt;questions and answers regarding concurrent receives&lt;/a&gt; and should also help you decide if you need this and if you do what value would benefit you.&lt;/p&gt; &lt;p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;strong&gt;&lt;span style="font-family: 'Segoe UI','sans-serif'; color: blue; font-size: 12pt; mso-font-kerning: 12.0pt"&gt;&amp;lt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="font-family: 'Segoe UI','sans-serif'; color: #a31515; font-size: 12pt; mso-font-kerning: 12.0pt"&gt;endpointBehaviors&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="font-family: 'Segoe UI','sans-serif'; color: blue; font-size: 12pt; mso-font-kerning: 12.0pt"&gt;&amp;gt; &lt;br&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="font-family: 'Segoe UI','sans-serif'; color: blue; font-size: 12pt; mso-font-kerning: 12.0pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="font-family: 'Segoe UI','sans-serif'; color: #a31515; font-size: 12pt; mso-font-kerning: 12.0pt"&gt;behavior&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="font-family: 'Segoe UI','sans-serif'; color: blue; font-size: 12pt; mso-font-kerning: 12.0pt"&gt; &lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="font-family: 'Segoe UI','sans-serif'; color: red; font-size: 12pt; mso-font-kerning: 12.0pt"&gt;name&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="font-family: 'Segoe UI','sans-serif'; color: blue; font-size: 12pt; mso-font-kerning: 12.0pt"&gt;="MyEndpointBehavior"&amp;gt; &lt;br&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="font-family: 'Segoe UI','sans-serif'; color: blue; font-size: 12pt; mso-font-kerning: 12.0pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="font-family: 'Segoe UI','sans-serif'; color: #a31515; font-size: 12pt; mso-font-kerning: 12.0pt"&gt;dispatcherSynchronization&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="font-family: 'Segoe UI','sans-serif'; color: blue; font-size: 12pt; mso-font-kerning: 12.0pt"&gt; &lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="font-family: 'Segoe UI','sans-serif'; color: red; font-size: 12pt; mso-font-kerning: 12.0pt"&gt;maxPendingReceives&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="font-family: 'Segoe UI','sans-serif'; color: blue; font-size: 12pt; mso-font-kerning: 12.0pt"&gt;="5" /&amp;gt; &lt;br&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="font-family: 'Segoe UI','sans-serif'; color: blue; font-size: 12pt; mso-font-kerning: 12.0pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="font-family: 'Segoe UI','sans-serif'; color: #a31515; font-size: 12pt; mso-font-kerning: 12.0pt"&gt;behavior&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="font-family: 'Segoe UI','sans-serif'; color: blue; font-size: 12pt; mso-font-kerning: 12.0pt"&gt;&amp;gt; &lt;br&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="font-family: 'Segoe UI','sans-serif'; color: blue; font-size: 12pt; mso-font-kerning: 12.0pt"&gt;&amp;lt;/&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="font-family: 'Segoe UI','sans-serif'; color: #a31515; font-size: 12pt; mso-font-kerning: 12.0pt"&gt;endpointBehaviors&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="font-family: 'Segoe UI','sans-serif'; color: blue; font-size: 12pt; mso-font-kerning: 12.0pt"&gt;&amp;gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span&gt; &lt;p&gt;&lt;span style="color: #0000ff"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9856569" width="1" height="1"&gt;</description></item><item><title>ServiceThrottlingBehavior defaults for .NET 4</title><link>http://blogs.msdn.com/sajay/archive/2009/07/21/servicethrottlingbehavior-defaults-for-net-4.aspx</link><pubDate>Tue, 21 Jul 2009 23:59:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9843865</guid><dc:creator>Sajay</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/sajay/comments/9843865.aspx</comments><wfw:commentRss>http://blogs.msdn.com/sajay/commentrss.aspx?PostID=9843865</wfw:commentRss><description>&lt;p&gt;This is one of the new updates that you will find with the .NET 4 installation. This was a decision we reached after understanding the fact that almost all customers had to bump this number up to a sweet spot of around 100 sessions. However the initial decision of keeping a very low number was a conscious one. We wanted to make sure this throttle would be hit really early on the development cycle and would cause a forced learning of service throttling behavior and how you need to think about performance of your service.&lt;/p&gt;  &lt;table style="background-color: #fcfcfc" border="1" cellspacing="0" cellpadding="0"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td width="164"&gt;&amp;#160;&lt;/td&gt;        &lt;td width="119"&gt;3.0 to .NET 3.5 Sp1&lt;/td&gt;        &lt;td width="194"&gt;.NET 4&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width="164"&gt;MaxConcurrentCalls&lt;/td&gt;        &lt;td width="119"&gt;16&lt;/td&gt;        &lt;td width="194"&gt;16* Processor Count&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width="164"&gt;MaxConcurrentSessions&lt;/td&gt;        &lt;td width="119"&gt;10&lt;/td&gt;        &lt;td width="194"&gt;100* Processor Count&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td width="164"&gt;MaxConcurrentInstances&lt;/td&gt;        &lt;td width="119"&gt;Sum (26)&lt;/td&gt;        &lt;td width="194"&gt;Sum (116*Processor Count)&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;There are few more goodies like more indicative performance counters to show you if your close to hitting this throttle value and if you need to bump this value up any more. For example if your 80% usage then you know that you have about 20% more throughput. But if your CPU is already fully loaded then probably you need to lower the values since you might actually have maxed out a much lower throughput value and it might be more optimal to process lesser calls.&lt;/p&gt;&lt;b&gt;Note:&lt;/b&gt; Cross posted from &lt;a href="http://www.sajay.com"&gt;Sajay&lt;/a&gt;.
&lt;br /&gt;&lt;a href="http://www.sajay.com/post/2009/07/17/ServiceThrottlingBehavior-defaults-for-NET-4.aspx"&gt;Permalink&lt;/a&gt;
&lt;br /&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9843865" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/sajay/archive/tags/WS-_2A00_+and+WCF/default.aspx">WS-* and WCF</category></item><item><title>What to Measure?</title><link>http://blogs.msdn.com/sajay/archive/2009/06/12/what-to-measure.aspx</link><pubDate>Sat, 13 Jun 2009 08:37:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9742128</guid><dc:creator>Sajay</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/sajay/comments/9742128.aspx</comments><wfw:commentRss>http://blogs.msdn.com/sajay/commentrss.aspx?PostID=9742128</wfw:commentRss><description>&lt;b&gt;Note:&lt;/b&gt; Cross posted from &lt;a href="http://www.sajay.com"&gt;Sajay&lt;/a&gt;.
&lt;br /&gt;&lt;a href="http://www.sajay.com/post/2009/06/12/What-to-Measure.aspx"&gt;Permalink&lt;/a&gt;
&lt;br /&gt;&lt;blockquote&gt;   &lt;p align="left"&gt;&amp;#160;&amp;#160;&amp;#160; If it doesn't run fast at first, it will run even slower later.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.sajay.com/image.axd?picture=image_2.png" width="412" height="249" /&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9742128" width="1" height="1"&gt;</description></item><item><title>Performance Testing for Web application - NeXpert</title><link>http://blogs.msdn.com/sajay/archive/2009/06/09/performance-testing-for-web-application-nexpert.aspx</link><pubDate>Tue, 09 Jun 2009 19:07:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9716393</guid><dc:creator>Sajay</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/sajay/comments/9716393.aspx</comments><wfw:commentRss>http://blogs.msdn.com/sajay/commentrss.aspx?PostID=9716393</wfw:commentRss><description>&lt;b&gt;Note:&lt;/b&gt; Cross posted from &lt;a href="http://www.sajay.com"&gt;Sajay&lt;/a&gt;.
&lt;br /&gt;&lt;a href="http://www.sajay.com/post/2009/06/08/Performance-Testing-for-Web-application-NeXpert.aspx"&gt;Permalink&lt;/a&gt;
&lt;br /&gt;&lt;p&gt;Here is a quick way to get an idea of how long your request/response takes and a ton of more data regarding your payload. &lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;neXpert is an add-on to Fiddler Web Debugger which aids in performance testing web applications. neXpert was created to reduce the time it takes to look for performance issues with Fiddler and to create a deliverable that can be used to educate development teams.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Blog - &lt;a title="http://blogs.msdn.com/nexpert/" href="http://blogs.msdn.com/nexpert/"&gt;http://blogs.msdn.com/nexpert/&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Video- &lt;a title="http://msdn.microsoft.com/en-us/dd573302.aspx" href="http://msdn.microsoft.com/en-us/dd573302.aspx"&gt;http://msdn.microsoft.com/en-us/dd573302.aspx&lt;/a&gt; - (4 minutes)&lt;/p&gt;  &lt;p&gt;Download -&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=5975DA52-8CE6-48BD-9B3C-756A625024BB&amp;amp;displaylang=en"&gt;http://www.microsoft.com/downloads/details.aspx?FamilyId=5975DA52-8CE6-48BD-9B3C-756A625024BB&amp;amp;displaylang=en&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Introduction - &lt;a title="http://blogs.msdn.com/nexpert/archive/2009/02/10/introducing-nexpert.aspx" href="http://blogs.msdn.com/nexpert/archive/2009/02/10/introducing-nexpert.aspx"&gt;http://blogs.msdn.com/nexpert/archive/2009/02/10/introducing-nexpert.aspx&lt;/a&gt;&lt;/p&gt;&lt;b&gt;Note:&lt;/b&gt; Cross posted from &lt;a href="http://www.sajay.com"&gt;Sajay&lt;/a&gt;.
&lt;br /&gt;&lt;a href="http://www.sajay.com/post/2009/06/08/Performance-Testing-for-Web-application-NeXpert.aspx"&gt;Permalink&lt;/a&gt;
&lt;br /&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9716393" width="1" height="1"&gt;</description></item><item><title>The Channel Pump</title><link>http://blogs.msdn.com/sajay/archive/2009/06/09/the-channel-pump.aspx</link><pubDate>Tue, 09 Jun 2009 19:04:38 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9716378</guid><dc:creator>Sajay</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/sajay/comments/9716378.aspx</comments><wfw:commentRss>http://blogs.msdn.com/sajay/commentrss.aspx?PostID=9716378</wfw:commentRss><description>&lt;b&gt;Note:&lt;/b&gt; Cross posted from &lt;a href="http://www.sajay.com"&gt;Sajay&lt;/a&gt;.
&lt;br /&gt;&lt;a href="http://www.sajay.com/post/2009/06/04/The-Channel-Pump.aspx"&gt;Permalink&lt;/a&gt;
&lt;br /&gt;&lt;p&gt;Deep dive - Nicholas Allen's talk on WCF performance and Scale - &lt;a href="http://mschnlnine.vo.llnwd.net/d1/pdc08/PPTX/TL38.pptx"&gt;PowerPoint Deck&lt;/a&gt; - &lt;a href="http://channel9vip.orcsweb.com/pdc2008/TL38/"&gt;Webcast&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;From the above talk you get an idea of the pull and the push model and a combination of these for certain channels. This defines how the message will be received on the transport and how they will be dispatched. Consider a pump as a loop doing some work. A pump works off a queue which it would push work on for the next layer or pulls work off when there is some work to be done.&lt;/p&gt;  &lt;p&gt;Considering a very common scenario like basic http where a message would arrive on the transport. The flow would consist of 2 loops. &lt;/p&gt;  &lt;p&gt;   &lt;table border="0" cellspacing="0" cellpadding="0"&gt;&lt;tbody&gt;       &lt;tr&gt;         &lt;td valign="top" width="224"&gt;           &lt;p&gt;&lt;a href="http://www.sajay.com/image.axd?picture=Windowslivewriter\Thechannelpump\channel%20pump.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="channel pump" border="0" alt="channel pump" align="left" src="http://www.sajay.com/image.axd?picture=Windowslivewriter\Thechannelpump\channel%20pump_thumb.png" width="218" height="240" /&gt;&lt;/a&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td valign="top" width="414"&gt;           &lt;h3&gt;Dispatcher/Message Pump&lt;/h3&gt;            &lt;p&gt;1. Dispatcher gets a message. It has available resources and will dispatch the operation(Application)              &lt;br /&gt;2. Dispatcher then tells the pump that it can accept the next message.&lt;/p&gt;            &lt;h3&gt;Channel Pump&lt;/h3&gt;            &lt;p&gt;1. Pump registers that it can take pull a message.              &lt;br /&gt;2. Message arrives and Transport pushes the message to the dispatcher.&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/p&gt;  &lt;p&gt;All channels affect how messages arrive and how they would be dispatched. We make a fundamental assumption in WCF that channels would always be fast. This is because of the fact that the channel is your infrastructure and it makes sense to put any heavy work to the application layer and not the channel layer.&lt;/p&gt;  &lt;p&gt;So general rule of thumb - &lt;strong&gt;&lt;em&gt;Do not do blocking or heavy work in your channels. Pass on the work to the upper application layer&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;  &lt;p&gt;You should think of your channel as gate to your dispatcher and you don't want to block the gate from letting the next person in. Hence bottom line is that a slow channel is a suboptimal channel.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9716378" width="1" height="1"&gt;</description></item><item><title>AsyncResults and IAsyncResults</title><link>http://blogs.msdn.com/sajay/archive/2009/06/09/asyncresults-and-iasyncresults.aspx</link><pubDate>Tue, 09 Jun 2009 19:02:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9716372</guid><dc:creator>Sajay</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/sajay/comments/9716372.aspx</comments><wfw:commentRss>http://blogs.msdn.com/sajay/commentrss.aspx?PostID=9716372</wfw:commentRss><description>&lt;b&gt;Note:&lt;/b&gt; Cross posted from &lt;a href="http://www.sajay.com"&gt;Sajay&lt;/a&gt;.
&lt;br /&gt;&lt;a href="http://www.sajay.com/post/2009/05/22/Implementing-IAsyncResult.aspx"&gt;Permalink&lt;/a&gt;
&lt;br /&gt;&lt;p&gt;Here is a deep dive on of how to implement your AsyncResult&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://www.sajay.com/page/Implementing-IAsyncResult.aspx"&gt;&lt;strong&gt;http://www.sajay.com/page/Implementing-IAsyncResult.aspx&lt;/strong&gt;&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Quick Pointers&amp;#160; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://www.sajay.com/post/2009/05/19/How-to-use-an-AsyncResult.aspx"&gt;Hello World - Using the IAsyncResult&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.sajay.com/page/Implementing-IAsyncResult.aspx#_AsyncResult.cs"&gt;Source AsyncResult.cs&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9716372" width="1" height="1"&gt;</description></item><item><title>How to use an AsyncResult?</title><link>http://blogs.msdn.com/sajay/archive/2009/06/09/how-to-use-an-asyncresult.aspx</link><pubDate>Tue, 09 Jun 2009 19:01:51 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9716364</guid><dc:creator>Sajay</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/sajay/comments/9716364.aspx</comments><wfw:commentRss>http://blogs.msdn.com/sajay/commentrss.aspx?PostID=9716364</wfw:commentRss><description>&lt;b&gt;Note:&lt;/b&gt; Cross posted from &lt;a href="http://www.sajay.com"&gt;Sajay&lt;/a&gt;.
&lt;br /&gt;&lt;a href="http://www.sajay.com/post/2009/05/19/How-to-use-an-AsyncResult.aspx"&gt;Permalink&lt;/a&gt;
&lt;br /&gt;&lt;p&gt;&lt;p&gt;I have a much longer &lt;a href="http://www.sajay.com/page/Implementing-IAsyncResult.aspx"&gt;article&lt;/a&gt; &lt;strike&gt;in mind for this and will be publishing it out soon&lt;/strike&gt;. But to quickly answer this let us use an implementation from the framework itself using a delegate. Please note, this is for a usage pattern sample only since all that a delegate does is put the work on the CLR's thread pool which means more latency for non-blocking work. &lt;span&gt;...&lt;/span&gt;&lt;/p&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9716364" width="1" height="1"&gt;</description></item></channel></rss>