Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint

Appendix Sometimes you'll have to complete tasks that apply to various recipes in this book, or you'll run into tasks that are too generic for a specific recipe (for example, creating a REST service with the help of WCF). Besides that, some topics are very interesting, but don't really fit in the recipe format, or are only of interest to some readers (for example, using NuGet). All that info and more can be found in this appendix, as a reference. Creating a REST service from WCF Using WCF services, it is possible to expose a REST endpoint. This way, we can easily create a WCF services project in which some services have a SOAP endpoint while others have a REST endpoint. In .NET 4.0, there are several ways to create REST services. In this example, we'll use a manual approach based on the WebHttpBinding . This process is quite simple: we need to make a configuration change to the configuration code of the service and apply an attribute on the service methods. We'll create a small sample service project and expose the service as a REST endpoint. To do so, create a new empty ASP.NET web application in Visual Studio 2010 and name it OfficeSupplies . Within the created web application, add a new WCF service called TonerService . This triggers the creation of both the service interface, ITonerService.cs and the service implementation, TonerService.cs .