还有什么更好的技术可以取代 MS 平台上的 ASMX Web 服务?

发布于 2024-11-09 13:06:33 字数 159 浏览 2 评论 0原文

微软不久前曾推动 Windows Communication Foundation (WCF) 来取代 Web 服务 ASMX 文件,但我不确定这至少在开始时有多成功。

现在首选使用什么方法?新版本的 WCF 是否变得更好用了?我主要创建和使用我目前在 MS 技术中使用的 Web 服务。

Microsoft was pushing Windows Communication Foundation (WCF) a while back to replace Web Services ASMX files but I'm not sure how successful that was at least at the beginning.

What is the preferred method to use now? Have newer versions of WCF gotten better to use? I am mostly both creating and consuming the web services I currently use in MS technologies.

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

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

发布评论

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

评论(2

白昼 2024-11-16 13:06:33

WCF 是 ASMX 的替代品。 ASMX 不会有进一步的开发(除了 bug 修复),而 WCF 正在改进(自从它在 .NET Framework 3.0 上发布以来,它已经在 3.5 和 4.0 上获得了新功能)。甚至还有一个 Codeplex 项目,可以在 http://wcf.codeplex.com

WCF is the replacement for ASMX. There will be no further development for ASMX (except for bug fixes), while WCF is being improved (since it was released on .NET Framework 3.0 it's already got new features on 3.5 and 4.0). There's even a codeplex project which previews some of the upcoming features on the next releases at http://wcf.codeplex.com.

是伱的 2024-11-16 13:06:33

WCF 已经取代了 ASMX Web 服务和 .NET Remoting。我相信它也包含企业服务(COM+/MTS),但我不是 100% 确定。根据我的经验,WCF 比 ASMX 或 Remoting 简单得多。这种轻松的部分原因在于非常简单的方法......定义一个契约(接口),定义一个实现此契约的服务,并可选择定义您可以传递的对象。

WCF 在托管这些服务方面非常灵活。在更高版本中,托管和配置选项已得到改进。

顺便说一句,如果您既是服务的提供者又是服务的使用者,WCF 允许您灵活地选择传输方式,而不管您的服务逻辑如何。我的意思是,如果您决定为您的服务选择比 HTTP 性能更高的选项(例如命名管道),您就不必将 asmx 重写为另一种技术。 WCF 服务与传输无关 - 这只是一个配置细节。

另外,还应该提到休息。由于现在很流行,WCF 支持 REST 风格的服务实现,但在我看来,在 ASP.NET MVC 中实现 REST 服务 API 会更好。

WCF has supplanted both ASMX web services and .NET Remoting. I believe it also wraps Enterprise Services (was COM+ / MTS) but I'm not 100% sure. In my experience, WCF is far easier than either ASMX or Remoting ever was. Part of that ease comes from the very straightforward approach... Define a contract (interface), define a service that implements this contract and optionally define objects that you can pass around.

WCF is pretty flexible in how these services can be hosted. In later versions the hosting and configuration options have improved.

As an aside, if you are both the provider and consumer of your services, WCF allows you the flexibility of choosing your transport regardless of your service logic. What I mean by that is that if you decide to choose a higher performing option that HTTP for your services (say, named pipes) you aren't stuck rewriting your asmx to another technology. A WCF service is agnostic of the transport - this is merely a configuration detail.

Also, REST should be mentioned. As it is all the rage these days, WCF supports the REST style of service implementation but in my opinion you'll be better served implementing a REST service API in ASP.NET MVC.

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