EPiServer Template Foundation WCF REST JSON service, part three

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. This is the final part in a series of three. The first and second parts are available here and here.

Building the project and adding it to the EPiServer website

Right click the WCF Services Application project and select Publish. Select File System as Publish method and target location to a location of your choice.

PublishProfile

Browse to the target location folder. Copy the project assembly from the bin-folder and into the website bin-folder. Finally copy the service folder to the root of your website.

This can of course be automated by adding post-build events to the WCF Service Application project.

Modifying web.config

We need to add the .svc-extension handlers. Otherwise our REST calls are going to end up as 404-errors.

Add the following handlers after the <clear/>-element.

Next we need to add the service to the <system.serviceModel>-element and define endpoints and a behavior for our service.

Running it

The result is in.

ArticlesAll

ArticlesMaxCount

What’s next?

By using the same technology you can use your strongly typed pages in EPiServer along with the standard page types in ETF and expose these as JSON using REST.

With ETF there’s a possibility of creating a base plate Windows Phone 7 application which uses these REST services. Stay tuned for that one… πŸ™‚

So now when the client asks you: “Well, EPiServer CMS seems to be really cool. But we want to extend our website to apps for Windows Phone 7, iPhone and possibly Android as well. How are you going to solve this for me?” you can just tell them: “ETF WCF REST JSON. What up?”

daniel
daniel
Developer
Recent Posts
  • Rikard Gaulitz

    Great guide Daniel! All EPi-devs should read this now that more and more web to app projects are coming in

  • Thanks Rikard!

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