Is there a WCF 4 sample app for this latest release.

Topics: Web Api
Jan 26, 2011 at 10:54 PM

I have been using the WCF Rest Contrib due to limitations in the existing WCF 4 implementation. However, it also has limitations such as a lack of help pages and no support for the EntLib 5 Application Blocks for things like Exception Shielding. I am interested in any development in the Codeplex code, which appears to be a replacement for the Starter Kit. There were a couple of samples in the zip file, but they don't seem to be a full WCF REST implementation. Is there something like this available?

Jan 26, 2011 at 11:06 PM

Hi Billy

In terms of automatic help pages, we do support that in WCF 4 natively

When you see a full WCF REST implementation do you mean an end to end more real world REST example? 


Jan 26, 2011 at 11:44 PM

Yes. I am hoping to find a real-world example of how to implement the new api. In particular, I am interested in using the WCF REST api for our mobile apps that will require the following capability:

  • Custom security validation (BASIC Authentication).
  • Support for x-www-form-urlencoded.
  • Microsoft Enterprise Library 5 support for:
    • Exception Shielding at the WCF boundary for all unhandled exceptions (I don't want sensitive information returned to the client).
    • Logging of the unhandled exceptions at the WCF boundary prior to throwing a new client-sensitive exception message.
    • Dependency Injection when the service is instantiated..
Jan 26, 2011 at 11:58 PM

Hi Billy

Just to set context, what you see on Codeplex is still very early so what is here is really a preview of what is to come. It is not complete. I would say as time progresses we will have more real world samples.

  • Custom security validation is not available yet. We will be introducing soon a new http channel where security concerns will be address. This will be the place if you want to use OAuth, API keys, etc.
  • Form url encoding actually is in the sample. See ContactManager which uses jQuery and does HTML FORM posts using x-www-form-urlencoded
  • Entlib is planning some integration packs for WCF. I would suggest going to the entlib site and posting a workitem / voting on entlib support
    • For exception shielding / logging of errors WCF has an IErrorHandler interface. I belive using the OperationContext you can get to the Message and then using our extension method ToHttpResponseMessage grab the response and set whatever you want before it is returned. I haven't tested this yet, but I will.
    • In terms of DI support we actually are looking in to this. If you look in the ContactManager you will see that it is using MEF to handle creationg of services and injection of their dependencies. The implementaiton is container agnostic and can support any container. This is just a prototype but we are actively looking at it.

Appreciate the feedback


Jan 27, 2011 at 1:11 AM

It sounds like you are making progress. Unfortunately, because we are exposing health apps we are constrained by HIPAA requirements, so that security is a big deal for us. So it sounds like we will need to wait for the release of your new security channel before even considering putting this into production. Do you have an ETA for that?

The WCF Rest Contrib has been very helpful, but also problematic going forward. It solved some problems, and created others.

I much prefer seeing all of this as a first-class citizen within the Microsoft WCF RESTful stack... and treated holistically with other initiatives, such as EntLib. Until then, I am finding that what has been touted as being the advantage of REST (simplicity) is much harder than a typical SOAP implementation, which is a no-brainer these days. It is almost deja-vue all over again insofar as we seem to be trying to solve the same issues the SOAP stack was initially designed to handle. In many ways, it feels like a step backward.

The reality is that mobile device support is a really big deal for us right now... but I have to say, this REST thing has been more than frustrating.

Jan 29, 2011 at 8:33 PM

We shouild have the new channels in place on Codeplex in a month or so. This will provide the hooks for doing OAuth but not provide an OAuth implementation. Thus it should enable you to address security using libraries like As far as when an out of the box OAuth solution will be available, we are currently working with the WIF team but I don't have an ETA.


Jan 29, 2011 at 8:37 PM

We are working on first class support for building RESTful systems. That is one of the core goals for this work! The product is in development. We are using Codeplex as a means to keep people in the loop as it gets developed so that you can weigh in our direction, suggest enhancements and tell us if you see us going over the cliff!