“Add Service Reference”: When WCF Metadata Goes Wrong

Monday, January 20, 2014

I was helping a student debug a WCF service the other day and stumbled upon a very annoying problem. Visual Studio refused to add a service reference to his service, no matter what we tried. After spending a few minutes copy-pasting configuration snippets from Stack Overflow, I decided to proceed more methodically and see what we're doing wrong. Here's the error we were getting, courtesy of the Visual Studio "Add Service Reference" dialog: At first, I was under the impression that something is wrong with the metadata endpoint itself. Perhaps I used the wrong spelling of IMetadataExchange? Or maybe I don't...
tags: ,
no comments

Great News: WCF MOC and XNA Windows Phone 7 Labs

Tuesday, August 24, 2010

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...
no comments

WCF Client Fault Size Limit

Saturday, August 7, 2010

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(bool throwFault, int stringLength){    string s = new string('A', stringLength);                if (throwFault)       ...
one comment

Debugging Distributed Transactions: Additional Examples

Thursday, July 29, 2010

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...
no comments

Debugging Distributed Transactions: Transactional Deadlocks, Part 2

Thursday, July 22, 2010

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...
no comments

Debugging Distributed Transactions: Transactional Deadlocks, Part 1

Monday, July 19, 2010

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 on data touched by the transaction. For most practical purposes, a SELECT statement effects a shared lock on all the rows returned by the statement, while...
no comments

Debugging Distributed Transactions: Fault Handling

Saturday, July 17, 2010

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 with the transaction. In other words, if you handle a fault from a transactional WCF service and...
no comments

Debugging Distributed Transactions: Configuring WCF Transaction Flow

Wednesday, July 14, 2010

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 attribute and the TransactionFlowOption enum. You can either disallow, allow, or mandate transaction flow to the service operation—violations of the contract result in a ProtocolException on the caller’s...
no comments

Race Condition When Modifying the HttpRequestMessageProperty in an Outgoing WCF Message

Wednesday, February 3, 2010

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 my original take on the dispatch code: ...
no comments

SDP 2009: Building Workflow Services with WF 4.0 and WCF 4.0

Saturday, January 2, 2010

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.0 and how to integrate a workflow application into Windows Server AppFabric....
tags: , , ,
one comment