gpt4 book ai didi

休息 WCF 与 Web api

转载 作者:行者123 更新时间:2023-12-04 18:33:46 25 4
gpt4 key购买 nike

我阅读了一些文章并搜索了很多关于 Rest WCF vs Web api 之间差异的信息,但我只是发现了 WCF vs Web api 之间的差异,我发现了一些差异:

WCF Rest=> a)It support HTTP GET and POST verbs by [WebGet] and [WebInvoke] attributes respectively. b)To enable other HTTP verbs you have to do some configuration in IIS to accept request of that particular verb on .svc files. c)Passing data through parameters using a WebGet needs configuration. The UriTemplate must be specified. d)It support XML, JSON and ATOM data format.

WebApi=> a)Unlike WCF Rest service, it use the full featues of HTTP (like URIs, request/response headers, caching, versioning, various content formats). b)Responses are formatted by Web API’s MediaTypeFormatter into JSON, XML or whatever format you want to add as a MediaTypeFormatter.

我想知道它们之间的其他区别,什么时候使用 WebApi 更好,什么时候使用 Rest Wcf

最佳答案

我会说,如果您开始一个新项目并且需要在 .NET 中公开一个 REST Web 界面,Web API 是最佳选择,因为据我所知,WCF 已被弃用。如果您必须同时公开 SOAP 和 REST Web 界面,我只会考虑使用 WCF Rest。

关于休息 WCF 与 Web api,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38749241/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com