JQuery - WCF Data Service
This section explains about how to call the Data service from the web client using JQuery. Now let's understand this concept by calling the service from MVC application and display the data in web page. We are going to use the same service created in previous example.
Create a sample MVC project and run the application.
Modify the "Index.cshtml" with below code and run the application
Run the application and click "Load data".
- Always create the service with Interface->Implementation format, mention the contract in Interface.
- Define the service in Class library and refer the class library in Host project. Don’t use service class in host project.
- Change the instance mode to per call as default.
- Always catch exception using try/catch block and throw exception using FaultException < T >.
- Logging and Include exception should be enable while compiling the project in debug mode. While in production deployment disable the logging and Include exception details.