哪一个更适合 jQuery.ajax 调用? .Net Web 服务还是 .ashx?

发布于 2024-10-30 01:36:07 字数 171 浏览 4 评论 0原文

我最近一直在练习 jQuery.ajax()。我已经开始学习使用 jQuery.ajax() 调用 .Net Web 服务。

现在我正在考虑是否仅使用 jQuery.ajax() 调用服务器上的某些服务方法;拥有 .Net Web 服务仍然有意义吗?或者我应该使用 .ashx 处理程序?

谢谢!

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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

黯然#的苍凉 2024-11-06 01:36:07

两段引自 ASP.NET 论坛

除非负载非常高,否则您会发现所有
三个的表现几乎相同。你里面的代码的性能
处理程序/服务将成为限制因素。

对于仅用于公开的简单 AJAX 调用
浏览器,我认为 WCF 没有理由增加其复杂性。这很棒
对于某些事情,但我很难推荐它。

在 ASMX 和 HttpHandler 之间,我每次都会选择 ASMX。一个
HttpHandler 的速度可能快得可以忽略不计,但是 ASMX“ScriptService”
进行复杂类型的 JSON 序列化和反序列化
透明,非常有用。


这是另一种选择:

如果您有一些想要运行的方法(并且您喜欢 JQuery)...我
建议看看这个:

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

及相关文章。做工很漂亮。就目前而言非常高效
带宽去。他们还有一篇关于查询 .asmx 服务的文章。

ASP.NET 固有的臃肿尺寸不容忽视
阿贾克斯。由于开箱即用的 AJAX 可能会非常臃肿。再加上它非常
简单。

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 complexity. It's great
for some things, but I have a hard time recommending 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 complex 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.com/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.

您还应该看看微软最新的 Web 服务框架:WebAPI

就个人而言,我最近切换了到 ServiceStack.NET 来获取我的 Web 服务,我发现它更加简单和优雅(比 WebAPI 或 WCF )。

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).

沙与沫 2024-11-06 01:36:07

WCF 服务将是优于 ASP.NET Soap Web 服务或 ashx 服务的首选方法。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文