DCSIMG
WCF - All Your Base Are Belong To Us

All Your Base Are Belong To Us

Mostly .NET internals and other kinds of gory details

Browse by Tags

All Tags » WCF (RSS)
Great News: WCF MOC and XNA Windows Phone 7 Labs
This is just a quick post to let you know about two important accomplishments we at Sela had in the past few days. In a few days, the WCF 4.0 MOC 10263A (Microsoft Official Course) is going to be released to training centers all over the world. This course was developed by Sela from scratch, and I’ve been a fly on the wall during its production process. (Well, to tell you the truth, I did quite a bit of technical editing work on this project, which has certainly earned me some hate from the content...
WCF Client Fault Size Limit
Configuring WCF message quotas on the server and client sides is not a trivial task. There are quite a few settings that you can tweak, including limits for a single string’s length in a message , the number of objects in the serialization graph , the serialization depth , and the array size . However, there’s one limit my service hit a few days ago that I wasn’t at all aware of—I didn’t even realize there was a reason for it to exist. Consider the following service method: public   string Foo...
Debugging Distributed Transactions: Additional Examples
In this final installment we’ll take a look at some additional examples of problems caused by distributed transactions. The following execution history results in a deadlock. What would you suggest to address it? Time Transaction 1 (Inventory Service) Transaction 2 (Shipping Service) 0 Select all orders by customer A   1 Calling Shipping Service, passing to it each order Receive order from Inventory service 2   Select the customer’s shipping address 3   Update the shipping date of...
Debugging Distributed Transactions: Transactional Deadlocks, Part 2
It’s time to add WCF services to the mix and see how their presence adds to the complexity of the otherwise non-trivial transactional deadlocks. Consider the following transaction: Client: Begin transaction Client: Select all orders by customer A Client: Call a WCF service and pass to it the list of orders Service: Update the shipping date of all selected orders Client: Commit If both parties share the same distributed transaction, it completes successfully. However, if the transaction flow between...
Debugging Distributed Transactions: Transactional Deadlocks, Part 1
The most commonly encountered problem with distributed transactions is that of transactional deadlocks. Transactions guarantee isolation, which is usually effected through locks. This is the case with SQL Server (as well as other relational databases) transactions. Transaction isolation levels provide additional granularity as to when and whether the locks are released prior to the completion of the transaction. Database Locks Simply put, the database issues shared (read) and exclusive (write) locks...
Debugging Distributed Transactions: Fault Handling
How is a WCF service call under a distributed transaction different from a regular WCF service call? The primary difference is the transactional abort semantics in case of failure. If the WCF service operation fails when there is no ambient transaction, the failure can be contained—the service caller may decide to ignore the error and proceed. However, if the WCF service operation fails within a distributed transaction, the transaction’s abort flag is set (by default), so that the caller cannot proceed...
Debugging Distributed Transactions: Configuring WCF Transaction Flow
This is the first in a short series of posts in which we’ll debug problems that arise from the use of distributed transactions in WCF. Particularly, we will look into deadlocks, timeouts, and miscellaneous transaction-related issues. To begin with, here’s a brief recap of what has to be done to flow a transaction across WCF service calls: The WCF operation must be decorated with the [TransactionFlow] attribute and the TransactionFlowOption enum. You can either disallow, allow, or mandate transaction...
Race Condition When Modifying the HttpRequestMessageProperty in an Outgoing WCF Message
I’ve stumbled upon a fairly obscure race condition in WCF’s implementation of the HTTP transport, and just wanted to quickly share it with you should you ever encounter it. I was using a simple publish/subscribe router similar to the one I’ve blogged about two years ago to automatically publish notifications to a list of subscribers. The router is a WCF service that implements a generic interface that takes a Message and creates multiple copies of it to send to all registered subscribers. Here’s...
SDP 2009: Building Workflow Services with WF 4.0 and WCF 4.0
Eran and I delivered a session titled “Building Workflow Services with WF 4.0 and WCF 4.0” at the Sela Developer Practice on Tuesday. This session was all about integrating the new features of WF 4.0 and WCF 4.0 to create a workflow application that orchestrates the execution of multiple WCF services. During the session, we showed how to use WCF 4.0’s ad-hoc discovery, how to write declarative workflows and use custom activities, how to take advantage of the built-in messaging activities in WF 4...
WCF Namespace Mismatch
A couple of days ago I have been bitten by an (really stupid, in hindsight) error when working with WCF services.  I had a service and a client set up to use a contract using a contract link (see my post from a few months ago about using contract links as a replacement for service references ). For some reason, I couldn’t get any data transmitted from the client to the service.  Everything worked great and there were no exceptions, the bindings seemed to be absolutely identical, the contract...
Sharing WCF Contracts as Visual Studio File Links
There are multiple ways of sharing WCF contract types across service boundaries. The recommended way, which I have no intent of undermining, is sharing contracts via service metadata. This means that the contract CLR types can be private (internal) to the service, and regenerated on the consumer's side from the service metadata. This provides full decoupling between the service and its consumers, guarantees that there is no dependency on CLR-specific information that can't be conveyed in...
Pragmatic BizTalk Services: File Sharing Service
In the previous post in this series , we have looked into BizTalk Services, opened an account and got ourselves ready for moving on to actually implementing a ISB service. Our service is a file sharing service, that roughly provides me with the following extremely important capabilities: Let's design the data contracts first: [ DataContract ] class SharedFile { [ DataMember ] public string FileName { get ; set ; } } [ DataContract ] class SharedFileData { [ DataMember ] public SharedFile File...
Pragmatic BizTalk Services: Introduction
A service bus is an architectural style or a service design pattern that provides a level of indirection between multiple cooperating services. This indirection alleviates the differences in message exchange patterns, network protocols, authentication and authorization, and multiple other infrastructure mechanisms. One of the best and shortest descriptions of a service bus is the following: Once a service gets on the bus, anything else on the bus can connect to it. (Jon Flanders and Aaron Skonnard...
LINQ To SQL: Surprising Features
In a previous post , I've outlined my subjective opinion regarding the differentiating features of Entity Framework compared with LINQ to SQL. This time, I'd like to focus on a couple of possibly surprising LINQ to SQL features that do not fall within the straight and narrow MSDN samples and conference presentations. Assume that we're developing a three-tier application that sounds like the classic candidate for ADO.NET Data Services or the Entity Framework. We have a database, which...
Forwarding Context-ful Messages
Workflow Services (introduced in .NET 3.5) are based on a simple convention for passing the workflow instance identifier from the client to the workflow and from the workflow to any services it invokes. This convention revolves around the use of context-ful bindings ( BasicHttpContextBinding , WSHttpContextBinding , NetTcpContextBinding and others) and a simple dictionary which contains a key called "instanceId" and a value that contains the workflow instance identifier. This information...
More Posts Next page »