A Tech Log

October 13, 2008

Build a Queued (MSMQ) WCF Response Service

Filed under: Development — adallow @ 9:28 am
Tags: ,

Juval Lowy has an interesting article over on MSDN about building a queued WCF response.

http://msdn.microsoft.com/en-us/magazine/cc163482.aspx

“Windows Communication Foundation (WCF) enables disconnected work between clients and services. The client posts messages to a queue and the service processes them later. Such interaction permits a different programming model from the default request/response pattern, enabling possibilities such as load leveling, improved availability, and compensating work, to name just a few. This column starts with a brief introduction to Windows® Communication Foundation queued calls and then presents an interesting problem-how to get results out of a queued call-and the solution via some cool Windows Communication Foundation programming techniques and a few helper classes I wrote for this purpose.”

Returning a HTTP Respose Code from WCF Rest

Filed under: Development — adallow @ 9:26 am
Tags: ,

The WebOperationContext has a property called OutgoingResponse (which is of type OutgoingWebResponseContext) which in turn has a StatusCode property that you can set. WebOperationContext.Current is available for REST based WCF services in much the same way as HttpContext is available for ASMX/ASPX and ServiceContext is available for normal (non rest) WCF Services

WebOperationContext.Current.OutgoingResponse.StatusCode 
     = System.Net.HttpStatusCode.OK;

Create a free website or blog at WordPress.com.