最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Which one is better for jQuery.ajax calls? .Net Web-Service or an .ashx? - Stack Overflow

programmeradmin1浏览0评论

I ahve been practicing jQuery.ajax() recently. I have started to learn to call .Net web-services qith jQuery.ajax().

Now I am considering if I will use only jQuery.ajax() calls to some service methods on the server; is it still meaningfull to have .Net Web-Services or I should go with .ashx handlers instead?

Thanks!

I ahve been practicing jQuery.ajax() recently. I have started to learn to call .Net web-services qith jQuery.ajax().

Now I am considering if I will use only jQuery.ajax() calls to some service methods on the server; is it still meaningfull to have .Net Web-Services or I should go with .ashx handlers instead?

Thanks!

Share Improve this question asked Apr 4, 2011 at 19:06 pencilCakepencilCake 53.4k87 gold badges236 silver badges377 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 6

Two quotes from the ASP.NET forums:

Unless it's an extremely high load situation, you'll find that all three perform nearly identically. The performance of your code inside the handler/service is going to be the limiting factor.

For simple AJAX calls that are only intended to be exposed to the browser, I don't think WCF justifies its added plexity. It's great for some things, but I have a hard time remending it for this.

Between ASMX and HttpHandler, I go with ASMX every time. An HttpHandler is probably negligibly faster, but an ASMX "ScriptService" makes JSON serialization and deserialization of plex types transparent, which is immensely useful.


Here's another option:

If you have some methods you want to run (and you like JQuery)... I suggest looking at this:

http://encosia./2008/05/29/using-jquery-to-directly-call-aspnet-ajax-page-methods/

and related articles. Works beautiful. Very efficient as far as bandwith goes. They also have an article on querying .asmx services.

There is no messing around with the bloated size of ASP.NET's innate AJAX. Since AJAX out of the box can be very bloated. Plus it's very easy.

You should also have a look at microsoft's most recent framework for web services: WebAPI

Personally, I recently switched to ServiceStack.NET for my web services, and I find it's a lot easier and elegant (than WebAPI, or WCF).

a WCF service would be the preferred method over ASP.NET soap web services or ashx services .

发布评论

评论列表(0)

  1. 暂无评论