What are the pros and cons when choosing ajax enabled WCF service in an asp.net webform application?

假如想象 提交于 2020-01-01 07:09:11

问题


I have just experimented my first ajax enabled WCF service in a sample asp.net webform application... If i have 10-15 pages in my webapplication which involves add,edit,view and delete operations, is it possible to make them ajax post and get without using .cs(codebehind) of all pages...

What are the pros and cons when choosing ajax enabled WCF service in an asp.net webform application?


回答1:


At first, if you want to implement the server side of jQuery Ajax calls, you can do this with either ASMX or WCF services. You can find a short comparison between these two here. WCF is more modern technology and will be my preferred choice for new projects. It can provide you with the following:

  • Help you program against an interface
  • It will serialize/deserialize objects to JSON for you. No need for JSON libraries
  • Provides client methods that you can use (via the ScriptManager). It is also easy to use jQuery if you prefer

As an disadvantage I would say that it will take you some time to learn the technology. I found that proper configuration of web.config was a little tricky.

I usually have a single svc service that serves all Ajax requests. You can implement as many methods as you want in a single service. The services are called from different pages.



来源:https://stackoverflow.com/questions/2228474/what-are-the-pros-and-cons-when-choosing-ajax-enabled-wcf-service-in-an-asp-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!