如果我想使用WebAPI作为一个服务连接到不同服务器上的多个数据库,并检索我的MVC应用程序将使用的数据,那么最好的方法是什么?
我不想让ApiController和我的MVC项目放在同一个项目中,所以我是否需要添加一个新的WebApi项目(删除除了控制器和模板添加的东西之外的所有东西,以获得一个干净的项目),我的MVC应用程序将引用这些项目吗?
下面是我曾经学习过的关于WebAPI的教程/博客文章列表:
ASP.NET Web带有可下载示例代码 http://weblogs.asp.net/jgalloway/archive/2012/03/16/asp-net-web-api-screencast-series-with-downloadable-sample-code-part-1.aspx的屏幕广播系列
使用HttpClient消费ASP.NET Web服务
http://debugmode.net/2012/03/03/creating-first-http-service-using-asp-net-web-api-part1-of-many/ http://debugmode.net/2012/03/07/consuming-asp-net-web-api-service-using-httpclient-part2-of-many/
使用 ASP.NET API和MVC4的CRUD操作
http://www.dotnetglobe.com/2012/03/crud-operation-using-aspnet-web-api-in.html http://www.dotnetglobe.com/2012/03/crud-operation-using-aspnet-web-api-in_28.html
为ASP.Net Web服务 http://blog.petegoo.com/index.php/2012/03/11/creating-a-net-queryable-client-for-asp-net-web-api-odata-services/创建一个.Net可查询客户端
使用HttpClient消费ASP.NET Web服务 http://www.johnnycode.com/blog/2012/02/23/consuming-your-own-asp-net-web-api-rest-service/
客户端支持ASP.NET Web https://msmvps.com/blogs/theproblemsolver/archive/2012/03/13/client-side-support-with-the-asp-net-web-api.aspx
创建和使用ASP.Net Web服务- MVC4 http://www.askamoeba.com/Opensource/Opensourcedetail/144/Create-and-Consume-ASP-Net-Web-API-REST-Services-MVC4
使用ASP.NET Web使用MediaTypeFormatter和OData支持构建和使用REST服务
http://robbincremers.me/2012/02/16/building-and-consuming-rest-services-with-asp-net-web-api-and-odata-support/
使用JSON.NET与ASP.NET Web
http://blogs.msdn.com/b/henrikn/archive/2012/02/18/using-json-net-with-asp-net-web-api.aspx
用ASP.NET Web为逗号分隔值(CSV)格式创建自定义CSVMediaTypeFormatter
http://www.tugberkugurlu.com/archive/creating-custom-csvmediatypeformatter-in-asp-net-web-api-for-comma-separated-values-csv-format
在ASP.NET Web 中实现CORS支持
http://blogs.msdn.com/b/carlosfigueira/archive/2012/02/20/implementing-cors-support-in-asp-net-web-apis.aspx
我如何看待Web
http://thedatafarm.com/blog/asp-net/how-i-see-web-api/
发布于 2012-04-13 11:55:21
您可以使用一个完全不同的项目来托管Web控制器。然而,在这种情况下,您需要考虑部署。
Web只是一个web项目。它将有自己的配置文件。很可能它将在自己的辅助进程中运行(取决于您如何部署它)。
因此,如果将Web分区,那么您将获得更大的灵活性,但最终可能会复制大量的配置。
我的建议是,如果您这样做了,请确保两个项目都与相同的基本服务项目对话。如果第三方可能使用此Web,分区也是有意义的。
https://stackoverflow.com/questions/10139699
复制相似问题