In this article, I am explain how to use a WCF service in MVC 5.
In my previous article I explained How to Create WCF Service in Visual Studio 2013.Now to continue from that article we will create a new project.
Right-click on Solution Explorer and add a new project.Select ASP.NET Web Application with .NET Framework 4.5.Select Empty MVC Template.Your MVC project will be added to the Solution Explorer.Now first copy the WCF service URL. (Please first check previous article here.)Now an EmployeeService service reference is added to your WebApplication.Now right-click on the Employee service and click on Configure Service Reference.Now uncheck Reuse type in referenced assemblies and click OK.Add a New Controller to the MVC application.Now add the following code to the Index action.Right-click on the Action method and Add View.Now Select Template List and Model class.Your View code will look like this.Now run the application (Ctrl + F5).
ASP.NET MVC 5: A Beginner’s Guide