2008 Oct 29
1 of 62 | Slides for WF 4.0: A First Look - Slides should be available soon on Channel9. Until then, I’ve made them available here.
...
2 of 62 | WF 4.0: A First Look - On Monday afternoon I unveiled WF 4.0 at PDC 2008. With this public disclosure you will start seeing a lot more details of the WF system here.
For those of you that were able to attend my session in person, please fill out the evaluation form (we’re currently at about 5% participation).
For those that couldn’t join me in person, the session was videotaped and is available at http://channel9.msdn.com/pdc2008/TL17/. Enjoy!
...
2008 Oct 06
3 of 62 | Interested in Performance? - Distributed applications are tricky. The internet is a fickle beast that will lost data at will and run counter to many intuitions. Getting distributed applications to run smoothly and performant at scale is particularly difficult. There isn’t a single "go fast" silver bullet, rather it’s more of an art. At PDC this year you’ll have a great opportunity to learn about the Zen of WCF Performance and Scale at Nicholas Allen’s lunch session. Enjoy!
...
2008 Oct 03
4 of 62 | WCF talks at PDC - Matt posted a great description of the WCF (and WF) talks we’re giving at PDC.
In particular there are two sessions that I’d like to call out.
The first is Ed Pinto’s session, where you’ll find out about the significant investments we’ve made to improve the WCF authoring experience:
WCF 4.0: Building WCF Services with WF in Microsoft .NET 4.0.
Eliminate the tradeoff between ease of service authoring and performant, scalable services. Hear about significant enhancements in Windows Communication Foundation (WCF) 4.0 and Windows Workflow Foundation (WF) 4.0 to deal with the ever increasing complexity of communication. Learn how to use WCF to correlate messages to service instances using trans......
2008 Sep 15
5 of 62 | PDC 2008 - I’ve gone dark on the technical side of this blog for two main reasons:
Most of what I’m working on hasn’t been publicly disclosed
I’m prepping for PDC 2008 where I can finally discuss the past 2 years of my life without an NDA
If you want to see the latest and greatest Microsoft technologies that we’ve been cooking up, register now, and then mark your schedule for my talk:
Windows Workflow Foundation 4.0: A First Look
Programs coordinate work. The code for coordination and state management often obscures a program’s purpose. Learn how programming with Windows Workflow Foundation (WF) 4.0 provides clarity of intent while preserving the functional richness of the .NET framework. See how ......
2008 Aug 07
6 of 62 | Asynchronicity, OneWay, and WCF - I’ve recently encountered some confusion around the behavior of one-way operations in WCF that I’m going to try and clear up. In particular, developers are under the impression that a one-way operation == a non-blocking call. However, this is not necessarily the case. A one-way operation means that we will call the underlying channel in a "one-way manner". For IOutputChannel/IDuplexChannel, this maps to channel.Send(). For IRequestChannel this maps to channel.SendRequest() followed by a check for a null response.
Now, sometimes the underlying channel can complete immediately (UDP will drop the packet if the network is saturated, TCP may copy bytes into a kernel buffer if there’s room, etc......
2008 Jul 01
7 of 62 | WF/WCF July MSDN Webcasts - Starting last month, MSDN put together a regular series of webcasts on WCF and WF (focusing on .Net 3.5). Here are the talks being broadcast in July:
July 7th, 10:00AM (PST) Transactional Windows Communication Foundation Services with Juval Lowy
July 9th, 10:00AM (PST) Using Windows Workflow Foundation to Build Services with Jon Flanders
July 11th, 10:00AM (PST) WCF Extensibility Deep Dive with Jesus Rodriguez
July 18th, 10:00AM (PST) SharePoint Server and WCF with Joe Klug
...
2008 May 06
8 of 62 | WsDualHttp and Faults - The other day a customer was sending unauthenticated messages to a service and the requests were timing out over WsDualHttp. When using WsHttpBinding or NetTcpBinding, the customer received an authentication MessageFault. Why was there no Fault returned over WsDualHttpBinding?
The reason has to do with securing composite-duplex channels. WsDualHttp uses two HTTP connections to provide its duplex nature, and messages are correlated between these two connections based on WS-Addressing (ReplyTo/MessageId). Because of this, the server behavior is entirely dependent on data received from the client. If this client is malicious, then he can cause the server to do a couple of things:
Initiate a......
2008 May 01
9 of 62 | WCF and TIBCO - Integration has arrived!
http://www.tibco.com/company/news/releases/2008/press900.jsp
...
2008 Apr 30
10 of 62 | When to use Async Service Operations - I was recently asked about the motivation for choosing asynchronous service operations in WCF (i.e. [OperationContract(AsyncPattern = true)]).
If you have an operation that is blocking (accessing SQL, Channels, etc) then you should use AsyncPattern=true. That way you’ll free up whatever thread we’re using to call your operation from. The general idea is that if you have a blocking call then you should use the async version and it should transparently play well with us.
Put another way: if you are calling a method that returns an AsyncResult (i.e. you’re accessing SQL, or using sockets, files, or channels), then you can wrap that IAsyncResult and return it from the BeginXXX call (or retur......
2008 Feb 25
11 of 62 | msg150.com - Some co-workers of mine from the old Indigo days are now working in downtown Seattle at Payscale. I just found out that they are keeping a blog of restaurant reviews for all the lunch spots in the I-district. They are taking a very methodical approach to this task. It’s quite an entertaining read, and may provide some inspiration the next time you’re in Chinatown!
...
2008 Feb 18
12 of 62 | TcpTransport’s Buffer Management in WCF - I’ve gotten some questions recently about how our net.tcp transport functions at the memory allocation level. While at its core this is simply an “implementation detail”, this information can be very useful for tuning high performance routers and servers depending on your network topology.
When writing a service on top of net.tcp, there are a few layers where buffer allocations and copies can occur:
Buffers passed into socket.Receive()
Buffers created by the Message class (to support Message copying, etc)
Buffers created by the Serialization stack (to convert from Message to/from parameters)
In addition, this behavior differs based on your TransferMode (Buffered or Streamed). In general......
2007 Dec 01
13 of 62 | Controlling HTTP Cookies on a WCF Client - A few customers have tried to control their HTTP Cookie headers from a smart client (using a previously cached cookie for example). The common experience has been “I enabled AllowCookies=true, and added the cookie using HttpRequestMessageProperty.Headers.Add. But somehow my cookie didn’t get included in my request.”
This is because “allowCookies” is a somewhat unfortunate name. When setting “allowCookies=true” on your HTTP-based binding (WsHttpBinding, BasicHttpBinding, etc), what you are indicating is that you want WCF to manage the cookie headers for you. That means that WCF will create CookieContainer, associate it with any IChannelFactory that is created from the binding, and then use t......
2007 Nov 09
14 of 62 | Performance Characteristics of WCF Encoders - As part of the Framework, we ship 3 MessageEncoders (accessible through the relevate subclass of MessageEncodingBindingElement):
Text - The “classic” web services encoder. Uses a Text-based (UTF-8 by default) XML encoding. This is the default encoder used by BasicHttpBinding and WsHttpBinding
MTOM - An interoperable format (though less broadly supported then text) that allows for a more optimized transmission of binary blobs, as they don’t get base64 encoded.
Binary - A WCF-specific format that avoids base64 encoding your binary blobs, and also uses a dictionary-based algorithm to avoid data duplication. Binary supports “Session Encoders” that get smarter about data usage over the course ......
2007 Oct 28
15 of 62 | Efficient usage of WCF clients - Wenlong has an excellent writeup of how write a WCF client with an eye towards performance.
...
2007 Jun 20
16 of 62 | InstanceContextMode, ConcurrencyMode, and Server-side Threading - When trying to write a scalable web service, you need to be aware of a few properties that affect how the WCF runtime will dispatch requests to your service: InstanceContextMode and ConcurrencyMode. In a nutshell, InstanceContextMode controls when a new instance of your service type is created, and ConcurrencyMode controls how many requests can be serviced simultaneously.
Others have covered the details of these two knobs in detail, you can check them out for more background. Here I’m simply going to explain the affect these settings can have on your threading behavior.
If you have set ConcurrencyMode == ConcurrencyMode.Single, then you don’t have to worry about your Service instances bei......
2007 Jun 02
17 of 62 | More details on MaxConnections - Here are some more “under the hood” details in response to the following question:
How is one supposed to interpret the NetTcpBinding.MaxConnections property on the client? My assumption has been that setting this property at the client only allows this number of concurrent connections, and further connection attempts will be queued until an existing connection is released.
MaxConnections for TCP is not a hard and fast limit, but rather a knob on the connections that we will cache in our connection pool. That is, if you set MaxConnections=2, you can still open 4 client channels on the same factory simultaneously. However, when you close all of these channels, we will only keep two of thes......
2007 Mar 14
18 of 62 | Client (TCP and Named Pipe) Connection Pooling - Using the TCP and Named Pipe bindings give you a very clean mapping between IDuplexSessionChannel and the underlying network resource (socket or pipe). Namely, you can effectively treat a channel as 1-1 to a socket (I will use socket as shorthand for the generic “network resource” for the remainder of this post ).
That being said, the lifetime of the underlying socket is not necessarily 1-1 with the lifetime of the channel. Due to our connection pooling feature in WCF, a connection can be reused over the lifetime of multiple channels. We perform connection pooling for both buffered and streaming channels. Our connection pool is configurable through TcpConnectionPoolSettings/NamedPipeConne......
2006 Dec 15
19 of 62 | On the Wire with channel.Open()/Close() - I got a question the other day about what data goes on the wire when you Open(), Close(), or Abort() our various transport channels. Here are the details in a nutshell (all the comments about net.tcp apply to net.pipe, simply substitute “named pipe” for “socket”):
HTTP Request (Client) Channels
Open() — Nothing goes on the wire for HTTP Request channels, as there is no context that they need to establish. HTTP channels use Open() to setup their identity contexts and Token Providers (if necessary).
Abort() — Abort will immediately terminate any outstanding calls to channel.SendRequest(). This in turn aborts any underlying TCP sockets (by sending an RST packet).
Close() — Close will wait (up......
2006 Nov 16
20 of 62 | Suppressing Expect 100-Continue on your Requests - WCF has a very powerful extensibility mechanism around modifying HTTP headers. However, you will get tripped up if you try and modify the “Expect: 100-Continue” header on outgoing requests. This is because System.Net will (by default) add this header on outgoing requests.
As a workaround, you can change the default for your application by setting a System.Net static:
System.Net.ServicePointManager.Expect100Continue = false;
...
2006 Nov 03
21 of 62 | Manipulating HTTP Headers in your WCF Message - I was going to write a quick note about how to suppress Expect 100-Continue as a result of this forum post. But it seems no one’s covered the background of WCF best practices for manipulating HTTP headers in general. So first, this post
Back in Beta 2, we stepped up our first class HTTP support by allowing WCF users to access and manipulate the HTTP headers that are sent on the wire. The programming model interface to this feature is through two Message Properties: HttpRequestMessageProperty (for HTTP requests) and HttpResponseMessageProperty (for HTTP responses, as you might expect). They are represented as Message Properties and not Message Headers since they are transport-specific in......
2006 Oct 28
22 of 62 | Security and Streamed Messages - When I talked about transferring large messages with WCF, I neglected to cover how security interacts with streamed messages.
A number of V1 binding elements require message buffering. For example, WS-RM (ReliableSessionBindingElement) buffers messages so that it can retry sends when they fail. The integrity (signing) protocol provided by WS-Security requires buffering of the message since the signature is stored in a message header (and headers are sent out prior to the streamed body).
The system provided bindings in V1 that support streaming are BasicHttpBinding, NetTcpBinding, and NetNamedPipeBinding. To enable bidirectional transport-level streaming, set the TransferMode on your bin......
2006 Oct 19
23 of 62 | Using WCF with NLB - There comes a point in time when one server is just not enough. You need to scale your service across multiple back-ends. Enter Windows Network Load Balancing (a.k.a. NLB). By using NLB, TCP connection initiations can be serviced by different machines.
This has an obvious impact on in-memory sessions. If you are using a protocol such as WS-Reliable Messaging (which will reestablish connections during the course of a session), then you want to make sure subsequent connection requests go to the same back-end server. Similarly, when using a transport such as HTTP (which can in worst case scenarios use a new connection for each request-reply) you will also need to ensure consecutive connec......
2006 Sep 28
24 of 62 | Channel 9: Using WCF Tracing - End to end (E2E) tracing is a very useful tool for tracking down bugs that occur in a distributed system (such as Indigo). You can learn more about it from a new Channel 9 video on WCF tracing that features Laurence from the Tracing product team.
...
25 of 62 | Setting Credentials for your HTTP Proxy - This question came up a few times while I was away for my honeymoon: “If I am using BasicHttpBinding or WsHttpBinding, how do I setup the credentials for my proxy?”
In my earlier post on HTTP proxies I noted that all of our transport security implementations (including HTTP proxy authentication) leverage the shared WCF-wide credential provisioning framework. As a result, it’s pretty straightforward to configure your proxy credentials. I think what trips people up is that we don’t have a separate “ProxyCredentials” object. Rather, both the proxy authentication and the ultimate server authentication access credentials from the same location (such as ChannelFactory.Credentials).
One limitati......
2006 Aug 16
26 of 62 | What IP Address(es) do we listen on? - When listening on any socket-based protocol (http, net.tcp, UDP, SMTP, etc), there are ultimately two items that contribute to where we listen: IP Address and Port.
Your port# is usually specified in the URI of your endpoint (see RFC 2396, section 3.2.2). If a port# is not specified then each URI scheme has the option of supporting a default port# (HTTP uses 80, HTTPS uses 443, net.tcp uses 808, etc.). You can also configure a WCF endpoint to listen on
any available port# for client-side or Discovery/registry purposes.
For WCF transports, your IP Address is specified in the same manner, though this may not be obvious on the surface. If you specify an IP Address in the hostname of your ......
2006 Jul 25
27 of 62 | Washing the SOAP from Messages - Now that the July CTP is public, I can divulge the details of a feature that I added to WCF in April.
In PDC ‘05 we showed how you can use WCF extensibility to send “POX” (Plain Old Xml) Messages via our runtime. However, it took some magical incantations to enable. These including setting HttpMappingMode on the HttpTransportBindingElement, and writing a custom encoder that only writes out the body of the Message.
In July CTP, you now get 1st class support for POX-style Messages. To accomplish this, we added new Addressing and Envelope Versions (AddressingVersion.None and EnvelopeVersion.None). I’m also happy to report the obsolescence and removal of HttpMappingMode (nee MapAddressing......
2006 Jul 12
28 of 62 | Transports Quotas - Nicholas has a great post explaining the various knobs available to be tweaked at the Transport layer. He also explains the post-RC0 changes we made to connection pool settings and throttling.
For developer settings, you shouldn’t need to touch the defaults, but for live deployments you will find these knobs quite useful. Our guidance on actual tuning is currently, uhm, thin but I’ve promised Christian that I’ll remedy that after I’ve beaten the last few WCF stress bugs into submission
...
29 of 62 | WCF Blogging Machine - In case you haven’t noticed, Nicholas has been blogging up a storm since his arrival at Microsoft — I highly recommend a subscription to his feed.
...
2006 Jun 24
30 of 62 | .NetFx 3.0 June CTP - Today we released our first Indigo CTP under the fresh .Net Framework label here. For 2k3 and XP users, download away (this build does not work with Vista Beta 2).
...
2006 Jun 14
31 of 62 | Beyond the .asmx/.svc suffix: Multiple Endpoints - One of the key improvements in WCF is the concept of multiple “endpoints” at a Service. Last week (when I was offsite with a customer) I had an interesting revelation. While we cover the “ABCs” of Indigo (Address + Binding + Contract == Endpoint) in every introductory talk, many users don’t fully grasp the flexibility multiple endpoint support offers. This is most acute with regards to hosting in IIS, when multiple endpoint support involves “URI space beyond the file”.
For example, let’s say I have an Image Download Service hosted at image.svc. For interop purposes I expose a BasicHttp endpoint. I also add a second endpoint that uses a binary encoding instead of text. I provide a rel......
2006 Jun 12
32 of 62 | New Community Site for WCF - Today at TechEd we unveiled our new community site for .Net 3.0 (including WCF/Indigo, WPF/Avalon, CardSpace/Infocard, and Workflow) at: http://www.netfx3.com.
For WCF-centric items, update your favorites from http://windowscommunication.net to http://wcf.netfx3.com/ (we will of course redirect you in the interim )
...
2006 Jun 07
33 of 62 | Building a “Composite” Transport - I’ve often written about how to write custom channels; transports in particular. In all of the examples I’ve given, the same transport is used for both sending and receiving messages (i.e. HTTP out, HTTP in). This parallelism fails in certain scenarios. For example, WS-Discovery defines a pattern where you send out a UDP Multicast probe (a broadcast request to find a peer), and expect (one or more) HTTP unicast responses back.
Constructing a binding for this scenario requires three pieces:
An outgoing transport
An incoming transport
A correlation mechanism to tie the request to the response
For the transports, you need a BindingElement that returns the outgoing transport from BuildChanne......
2006 May 04
34 of 62 | Exposing Capabilities on your Binding - Bindings represent a wide variety of functionality. Everything from different transports, to different security mechanisms, delivery mechanisms, transactions, and custom protocols. Nonetheless, there are times where you want to make a decision based on a binding’s capabilities.
For example: “Does this binding support ordered delivery?”
Or: “Does this binding support both client and server authentication?”
WCF has a polymorphic way of making such inquiries of a Binding, though there are a few subtleties involved.
The first pivot point is to decide whether the capability is a property of the actual Binding, or a property exposed by the stack of Binding Elements. For example, supporting ......
2006 Apr 20
35 of 62 | Configuration Http Proxies in WCF - When using Http, proxy configuration madness is a fact of life. If misconfigured, you can wind up trying to decipher obtuse 502 (Bad Gateway) and 504 (Gateway Timeout) errors.
Fortunately there are a number of binding settings available in WCF to control your Http proxy usage. These settings are available directly on BasicHttpBinding and WsHttpBinding (as well as on HttpTransportBindingElement when you are using a CustomBinding).
public bool UseDefaultWebProxy (default == true): if set to true, will use the global value HttpWebRequest.DefaultProxy as your proxy. HttpWebRequest.DefaultProxy is controllable through System.Net config, and defaults to using the system proxy settings (i.e. when......
2006 Apr 08
36 of 62 | Channel Authors unite! - Hot off the presses is a new resource for channel authors: the WCF Custom Channel Resources page at windowscommunication.net. This is a great portal for samples, documentation, and all things Channel-related.
The samples page contains updated versions of our PDC demos (WSE 3.0 TCP Interop and Chunking Channel) as well as new helpers for testing and generating config for your channels. Check it out!
...
2006 Mar 29
37 of 62 | Demystifying HostNameComparisonMode: Wildcards, and URI Matching - Today I was asked “what is StrongWildcard and WeakWildcard, and which one should I use?”. The piece of object model that my co-worker is asking about is:
public enum HostNameComparisonMode
{
StrongWildcard = 0,
Exact = 1,
WeakWildcard = 2,
}
Most bindings have a HostNameComparisonMode property on them. This property is used for service-side endpoints (IChannelListener), in conjunction with the ListenUri of that endpoint. The values are semantics similar to + and * for http.sys registrations. “Wildcard” vs. “Exact” refers to how we match the authority (hostname+port) piece of an incoming Uri. For “Wildcard”, anything matches. For “Exact”, we perform a case-insensitive string comparison ......
2006 Mar 17
38 of 62 | Creating a Service on “any free port” - By default, when creating a ServiceHost we require you to specify a base address (e.g. “http://kennyw.com/myService/”). This is because your clients needs to know where to send messages to. Sometimes you have a situation where you don’t need to know the exact address up front (let’s say you are using WS-Discovery or some other registry-based lookup). In that case, you want to indicate to the transport to “use any free port” (or “port 0″ in sockets-speak). Fortunately, Indigo has this functionality baked into our addressing parameters.
To signal you want this behavior, set ServiceEndpoint.ListenUriMode to ListenUriMode.Unique (the default is ListenUriMode.Explicit). At build time this wi......
2006 Feb 22
39 of 62 | WCF February CTP now available - The WinFx Runtime Components February CTP (including Avalon, Indigo, and Workflow) has been released here.
You can also download an updated Windows SDK and Visual Studio Preview.
There are a number of breaking changes from the January CTP. Ed has a good overview of them here. These changes are predominantly a result of community [...]...
2006 Feb 08
40 of 62 | Large Messages and WCF - CLR typed objects (and buffered messages) are great for a large breadth of applications. Sometimes though, you just want to push bytes. WCF provides a convenient way of doing so with “streamed methods”.
To use WCF’s “Streaming API” you write an operation with an input and/or output of type System.IO.Stream. Because [...]...
2006 Feb 06
41 of 62 | Tracing Tidbit: Getting Callstacks Automatically - When you get an Exception traced in Indigo, part of that trace includes the callstack which is naturally traced as part of Exception.ToString(). However, callstack information is generally useful for other non-Exception traces (for example, trying to track down who is Aborting a socket). Part of the beauty of our tracing infrastructure is [...]...
2006 Feb 03
42 of 62 | Enabling E2E Tracing for WCF - Tracking down bugs in distributed systems can be really difficult. One of the technologies we’re using in Indigo to help make this easier is known as “E2E Tracing” (for End to End Tracing). Of course, this technology is only as good as the traces that a system emits. In Beta 1, we weren’t so [...]...
2006 Jan 30
43 of 62 | Migrating ASMX to WCF - One question I was often asked last week was: “I have a bunch of ASMX services today, what is the best way for me to prepare for and/or migrate to Indigo”? (also asked as “can you tell me more about this ASMX migration thing?”). There are a number of ways to go about this, but [...]...
2006 Jan 19
44 of 62 | Time to Go Live! - Two very big announcements today:
WCF and WF "Go Live" bits are available on MSDN.
We launched a WCF community site. I highly recommend everyone check out (and bookmark) http://www.windowscommunication.net/. This will be a great resource for all Indigo users, and I encourage everyone to post samples and participate in the forums.
Happy messaging!
...
2006 Jan 10
45 of 62 | Coping with Indigo post-Beta 1 OM changes - Back from vacation and catching up on life in the rainy city (a little more rain in Seattle this time of year than Buenos Aires, go figure). While I was gone, Ed posted a good overview of the changes between Beta 1 and the November CTP. Don`t be put off by the number [...]...
2005 Nov 08
46 of 62 | WSE 3.0 available on MSDN - WSE 3.0 has just been released to the web. There are a number of great new features available, including compliance with the latest standards for secure web services, and guaranteed interoperability with WCF over http. You can also use my PDC sample to communicate with WSE 3.0 over TCP :)
Congrats to Mark, Hongmei, [...]...
2005 Oct 17
47 of 62 | In-proc transport thoughts - Every couple of months someone asks: "does Indigo have an in-proc transport" Which usually means "does Indigo have a way of sending messages so that it doesn`t ever leave the app-domain" When this request is made of the performance team, Al Lee`s canned response is "why aren`t you using named pipes Is it [...]...
2005 Sep 23
48 of 62 | WCF: Efficient Buffer Management - In order for a Transport to read and write Messages, it may buffer the serialized message. At the very least, the Headers need to be buffered. And in many cases (such as to avoid head of the line blocking issues), buffering the entire message is necessary.
While the CLR`s garbage collector does a really [...]...
2005 Aug 22
49 of 62 | PDC 2005: Learn all about Channels! - Right now there are two things that are consuming my life at work. The first is flushing out bugs and polishing off the final details of Indigo Beta 2. In the transports area you`ll see a lot of new HTTP functionality in Beta 2, including HTTP Streaming, cookie support, and fine grained extensibility [...]...
2005 Jul 27
50 of 62 | The Indigo Foundation - Today we announced the official names for Indigo, Avalon, and our ship vehicle (formerly known as "WAP" or "Windows API Pack").
It has been decreed that Indigo will henceforth be known as the Windows Communication Foundation. But don`t be surprised if I continue to refer to it as "Indigo" for a little while [...]...