O'Reilly logo

Microsoft Windows Communication Foundation 4.0 Cookbook for Developing SOA Applications by Steven Cheng

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Building a self-hosted REST service

Since a REST-style WCF service provides an endpoint that is accessible through standard HTTP GET/POST requests, it is quite common and reasonable to host a REST service in an ASP.NET web application (via a .svc file). However, we can also use any .NET-managed application to host a WCF REST service out of an IIS server.

In this recipe, we will demonstrate how to use a console application to host a WCF REST service.

How to do it...

Creating a self-hosted REST service is quite similar to a standard WCF service, but with some minor differences. Let’s take a look at the detailed steps here:

  1. Define the ServiceContract for the REST service.

    The first thing to do is define a ServiceContract for our sample REST service. Here ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required