Consuming a WCF Service

You consume a WCF service from a .NET client by adding a service reference to your project. Visual Studio then generates a proxy class for calling your service. You use this proxy class to call your service from your .NET client application. Your client application could be a website, any variety of Windows application, or an application on another platform. Let’s look at an example of calling WCF from an ASP.NET MVC site.

Note

ASP.NET 5 does not currently have the concept of a Service Reference (at least at the time of writing). Therefore, the example that follows uses an MVC application that targets ASP.NET MVC 6 (and not ASP.NET 5). This allows you to see the Service Reference concept in action.

You can also consume ...

Get Microsoft Visual Studio 2015 Unleashed, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.