EPiServer Template Foundation WCF REST JSON service, part one

In EPiServer

This blog series is about extending EPiServer Template Foundation (ETF) with a WCF service that can be accessed with REST and returns JSON. A’lot of acronyms means it’s really cool – right? Let’s get started!


brainWith the advent of iPhone, Android and Windows Phone 7 the industry has been rushing into the direction of Apps. We see a tremendous rise in demand with our clients to push their business onto the App-scene. We as developers need to address this need and delight our crowd.

EPiServer has launched their mobile center for iPhone. This is a great App with a’lot of potential for web editors.So are we forgetting someone? Yes, the visitors of your site. I took a few laps around making it easy to extend an EPiServer website into being App-friendly.

The concept

With the birth of Page Type Builder (PTB) we eventually saw the offspring of ETF. PTB addresses the issue of having strongly typed pages, and ETF gives you a running start with your EPiServer website by making standard page types and functionality for accessing their information readily available after installation.

All this means that we can access strongly typed page types like Articles and Contacts in ETF. This is all well except that from an App-perspective you’d need to go the route of either web browser or consume RSS-feeds and parsing these.

Instead let’s have a look at JavaScript Object Notation (JSON) together with Representational State Transfer (REST) architecture. Togetheer they’re a friendly solution for platforms outside the .NET sphere. While me might develop for Windows Phone 7 today, tomorrow we’ll be able to add devices running other platforms like iOS or Android.

Getting started

My example is based on running Windows 7 64-bit with IIS 7.

You’ll need the following:

The latest smoking hot version of EPiServer CMS

EPiServer Template Foundation

Full guide on how to set up ETF on an EPiServer website

With everything downloaded and installed we need to make an adjustment in order to get WCF working properly. Else we’ll be seeing a nasty 404-error because we haven’t got a handler for our .svc-extension.

  • Run a command window as administrator.
  • Navigate to “C:windowsMicrosoft.NetFramework64v3.0Windows Communication Foundation” (without “64” if you’re running a 32-bit OS).
  • Run the following command: ServiceModelReg –i

Now we should be good to go!

Setting up the project

Let’s add a new WCF Service Application project to our solution assuming you have created the EPiServer ETF website project using Ted Nyberg’s guide. I chose to call mine DBLOG.EPiCMS6Sandbox.Services while the EPiServer-website project with ETF is called DBLOG.EPiCMS6Sandbox.Website.

2010-11-05 12h59_47

Add the following folders

  • [assemblies]
  • Entities
  • Factories
  • Services

Add the following assemblies to the [assemblies]-folder

  • EPiServer.BaseLibrary.dll
  • EPiServer.dll
  • PageTypeBuilder.dll
  • System.Web.DataVisualization.dll
  • TemplateFoundation.dll

Subsequently add references to these assemblies to your Services-project.

Now the project structure should look something like this:


While you could create the service directly inside the Website-project I chose not to because I’d like to be able to distribute the service to multiple websites by simply adding the .svc-file and the assembly.

The project on its own won’t be able to access anything EPiServer but when run in the same application domain as our Website-project we’ll be rockin’. Either approach is of course perfectly fine.

Okay! We’re all set to do get into the nitty gritty of coding! On to part two!

Recent Posts
  • Crayleb

    Hi there Daniel – Just letting you know that the ProjectStructure.png image isn’t loading on this post either. Cheers.

Contact Us

We're not around right now. But you can send us an email and we'll get back to you, asap.

Not readable? Change text. captcha txt

Start typing and press Enter to search