asp.net - 使用 ASP.net Web API 作为服务层好吗?

标签 asp.net architecture asp.net-web-api

我和我的架构师正在为我们的一款产品设计架构,他建议使用 Web Api 作为服务层(因为它是一个轻量级组件)。

我立刻就在想它如何用于非基于 http 的客户端以及外部客户端。我们如何提供有关 API 的代理信息(如果 API 有复杂类型作为参数)?

请问我们是否可以使用Web API作为服务层?

最佳答案

Straight away I'm thinking how it can be used for non-http based clients

嗯,不能。 Web API 仅在 HTTP 协议(protocol)之上工作。如果您需要使用一些其他传输协议(protocol)(例如 UDP),您可以考虑使用 WCF。

How can we provide the proxy information about our API

RESTful 服务没有代理信息的概念。对于非 .NET 客户端,它们应该被很好地记录下来。对于 .NET 客户端,您可以在服务器和客户端应用程序之间共享契约(请求/响应 Dto)。然后,客户端应用程序可以重用这些 Dto,这些 Dto 可能充当您所谓的“代理”,并且存在于 SOAP 世界中,但不存在于 REST 世界中。

关于asp.net - 使用 ASP.net Web API 作为服务层好吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19045601/

相关文章:

c# - 系统.Web.HttpException : This is an invalid script resource request

c# - 如何将浏览器重定向到 ASP.NET 中的本地文件?

asp.net - 如何使用 localhost 测试来 self 们公司域的 cookie?

performance - 这种架构模式有名字吗?

sql-server - 需要帮助设计大型数据库更新流程

jquery - "The input was not valid".NET Core Web API 与 Razor 页面

c# - HttpContext.Current.Response.Flush() 与 response.redirect false

android - MVP 交互者和用例的关系

count - OData v4 WebAPI 响应中的项目计数

asp.net-web-api - Web API 方法 : Return IHttpActionResult Or IQueryable