The previous insus.net has demonstrated that the MVC application uses a Web service, and this article insus.net wants to continue the demo service, but it is a WCF service.
The two implementations are somewhat different.
Under the Services directory, create a calculator.svc service. After a successful creation, it generates an interface and a file for the SVC:
In Calculator.svc, it is the interface above the implementation, and all four methods are implemented:
After the WCF service is created, it can be viewed as normal:
The following is a reference to a WCF Service for an MVC application:
When you are done quoting, you will see the following information in Web. config:
Locate and open ExerciseController.cs, create the View ActionResult Wcfservicedemo () and Contentresult Getcalcresult ():
Create a wcfservicedemo.cshtml view under Views\exercise, in the following three steps:
The third step is the jquery code:
Live Demo: