ASP.NET页面方法vs Web服务

前端之家收集整理的这篇文章主要介绍了ASP.NET页面方法vs Web服务前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在构建动态部分加载asp.net页面,我想使用jQuery调用页面方法或Web服务来检索内容 HTML.

页面方法或Web服务,性能明智,哪种方式更好?

如果我调用页面方法,在服务器端,页面是否遍历整个生命周期?

有什么好的资源有助于我更好地了解网页的方法吗?

解决方法

您可以调用PageMethods和Web服务,而不需要ScriptManager控件(它生成可以使用熟悉的语法来调用Web服务和页面方法JavaScript代理对象).

文章using jQuery to directly call ASP.NET AJAX page methods

文章using jQuery to Consume ASP.NET JSON Web Services

这是一个MSDN article from 2007 on Web Services and Page Methods.简单地看看,它似乎仍然与他们的工作/你需要做什么来使他们今天工作是相关的.

性能明智:

You might expect page methods to offer
better performance than Web services.
After all,to resolve Web service
calls,the ASP.NET runtime has to
parse SOAP packets. This,however,
isn’t exactly true. ASP.NET AJAX
installs a tailor-made HTTP handler
(see Figure 3) that intercepts all
ASMX requests. Requests with a /js
suffix are processed differently,
working directly with the JSON payload
and Web service method. As a result,
no SOAP is involved whatsoever and the
body of the request simply contains
the JSON stream of input arguments.
For non-AJAX requests,the new HTTP
handler just delegates the call back
to the original ASP.NET handler that
understands SOAP.

为了响应页面生命周期,页面方法不会通过服务器端页面LifeCycle(也有一个client-side Page Lifecycle).

原文链接:https://www.f2er.com/aspnet/250392.html

猜你在找的asp.Net相关文章