WCF vs ASPX webmethods vs ASMX webmethods

发布于 2024-10-05 10:16:35 字数 811 浏览 5 评论 0原文

目的是创建一组人们可以重用的 Web 服务。这些服务主要与创建、检索和处理数据的后端数据库交互。

我们希望公开服务,以便人们可以用来创建数据混搭和其他应用程序。

最终用户是可以位于我们域内或域外的网页。对于域外的页面,我们计划发布配置为检索和显示数据的小部件。

一项要求是应用程序在其可处理的用户数量方面应具有极高的可扩展性。

我们的代码库是 .net,我们正在研究 ASPX webmethods(或 ASHX)、ASMX webmethods 和 WCF(开始阅读 WCF)。

在安全/访问方面,我发现维护 sessionid、成员资格在这三个方面都是可行的。 WCF 的设置似乎有点复杂。当我们仅使用 aspx 中的 webmethod(稍加调整)就可以完成所有工作时,我无法立即看到 asmx 的价值。

另外,假设使用 ASP.NET MVC2,我也可以为这些 Web 方法获取干净的 url。

问题

性能可扩展性而言,哪一个最有效? 我为什么应该选择 WCF 或 ASMX?

感谢您花时间阅读这篇文章,并对我提出的天真的问题表示歉意,因为我是 .net 的新手。

编辑 我有点明白 WCF 是要走的路。为了理解技术的演变,如果有人能阐明为什么 aspx webmethod 与 asmx 不同,而两者都可以完成类似的事情(除了发现之外),那就太好了。可以使 aspx webmethods 返回其他格式的数据(纯文本、json)。另外,我们似乎可以使用 ashx 构建 Restful 服务。再次为天真的问题道歉。

The intent is to create a set of web services that people can reuse. These services mostly interact with a backend DB creating, retreiving and processing data.

We want to expose services so that people can use to create data mashups and other applications.

End users are webpages that can be within our domain or outside our domain. For pages outside the domain we plan to release widgets that would be configured to retreive and display the data.

One requirement - application should be extremely scalable in terms of the number of users it can handle.

Our code base is .net and we are looking at ASPX webmethods (or ASHX), ASMX webmethods and WCF (starting to read up on WCF).

In terms of security/access I found that maintaining sessionid, memberships is doable in all three. WCF seems a bit complicated to setup. I could not immediately see the value of asmx when we can get all done just using a webmethod in aspx (with a little tweaking).

Also, assuming that with the ASP.NET MVC2 I might be able to get clean urls as well for these webmethods.

Questions

Which one will be the most effective in terms of performance and scalability?
Any reason why I should choose WCF or ASMX?

Thank you for taking the time to read through this post and apologies for the naive questions since I am new to .net.

EDIT I kind of understand that WCF is the way to go. Just to understand the evolution of the technologies it would be good if someone can throw light on why a aspx webmethod is different from an asmx when similar things (apart from discovery) can be accomplished by both. The aspx webmethods can be made to return data in other formats (plaintext, json). Also, it seems that we can build restful services using ashx. Apologies again for the naive questions.

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

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

发布评论

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

评论(3

风吹过旳痕迹 2024-10-12 10:16:35

您应该使用 WCF 在 .Net 中开发 Web 服务。 WCF 具有高度可配置性,具有许多安全、传输协议、序列化、扩展等选项。 Raw性能也显着提高。此外,WCF 正在积极开发,并在版本 3.5 和 4 中添加了许多新功能。还有 WCF 数据服务和 WCF RIA 服务等变体。 WCF 4.0 还具有更好的 REST 和 JSON 支持,您可以直接在ASP.Net/JQuery。

You should use WCF for developing webservices in .Net. WCF is highly configurable with many options for security, transport protocols, serialization, extensions etc. Raw performance is also significantly higher. Also WCF is being actively developed and many new features being added in version 3.5 and 4. There are also variations like WCF data services and WCF RIA services. WCF 4.0 also has better REST and JSON support which you can directly use in ASP.Net / JQuery.

苏辞 2024-10-12 10:16:35

ASMX 被视为已弃用的技术并由 WCF 取代。因此,如果您要开始需要公开可重用服务的新开发,WCF 就是您的最佳选择。

ASMX is considered deprecated technology and replaced by WCF. So if you are going to start new development which requires exposing reusable services, WCF is the way to go.

青朷 2024-10-12 10:16:35

我不一定不同意之前的答案。但是,从不同的角度来看,WFC 的配置很棘手。它需要配置文件中的绑定、端点、数据包大小、大量令人困惑的参数等,并且报告了许多序列化/反序列化问题。此外,WCF 是一项相对较新的技术(因此仍然存在错误和所需的补丁)。
客户端生成的 [Reference.cs] 文件可能具有不需要的接口,并且 WSDL 中公开的每个公共属性客户端类都是使用 LINQ to SQL 或实体框架使用的相同观察者模式(OnChanged、OnChanging 等)生成的,因此这增加了与传统的 SOAP Web 客户端方式相反,客户端代码较多。
我的建议是,如果您不使用 TCP 上的远程处理,或者不需要用于远程更改的 2 路通知机制 - 所有这些都是 WCF 非常酷的功能 - 您不需要使用它。

I am not necessarily disagreeing with previous answer. But, from a different perspective, WFC is tricky to configure. It requires bindings, endpoints, packet sizes, a lot of confussing parameters, etc in your configuration files, and there are many serialization/deserialization issues reported. Also WCF is a relatively new technology (therefore still exposed to bugs and patches needed).
The client-generated [Reference.cs] files might have unwanted interfaces, and each public property client class exposed in the WSDL gets generated with the same observer pattern that LINQ to SQL or Entity Framework uses ( OnChanged, OnChanging, etc) so this adds a lot of fat to the client code, as opposed to the traditional SOAP Web client way.
My recommendation, if you aren't using Remoting over TCP or if you don't need the 2-way notification mechanism for remote changes - all these are very cool features of WCF - you don't need to use it.

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