![](/img/trans.png)
[英]Deploy a solution with HTML5/Javascript project and separate ASP.NET Web API project on IIS
[英]ASP.NET Web Api as a standalone project in one solution
如果我想使用WebAPI作為服務連接到不同服務器上的多個數據庫並檢索我的MVC應用程序將使用的數據,那么最好的方法是什么?
我不希望ApiController與我的MVC項目在同一個項目中,所以我需要添加一個新的WebApi項目(刪除所有除了控制器和模板添加的東西都有一個干凈的項目)我的MVC應用程序會參考嗎?
這是我用來了解WebAPI的教程/博客文章列表:
ASP.NET Web API - 具有可下載示例代碼的Screencast系列 http://weblogs.asp.net/jgalloway/archive/2012/03/16/asp-net-web-api-screencast-series-with-downloadable-sample-碼部分1.aspx
使用HttpClient使用ASP.NET Web API服務
http://debugmode.net/2012/03/03/creating-first-http-service-using-asp-net-web-api-part1-of-many/ http://debugmode.net/2012/03/ / 07 /使用-HttpClient的-第2部分-的-許多消費-ASP網的Web-API服務
使用ASP.NET Web 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 API oData服務創建.Net可查詢客戶端 http://blog.petegoo.com/index.php/2012/03/11/creating-a-net-queryable-client-for-asp-net-網上API-的OData服務/
使用HttpClient來使用ASP.NET Web API REST服務 http://www.johnnycode.com/blog/2012/02/23/consuming-your-own-asp-net-web-api-rest-service/
使用ASP.NET Web API的客戶端支持 https://msmvps.com/blogs/theproblemsolver/archive/2012/03/13/client-side-support-with-the-asp-net-web-api.aspx
創建和使用ASP.Net Web API REST服務 - MVC4 http://www.askamoeba.com/Opensource/Opensourcedetail/144/Create-and-Consume-ASP-Net-Web-API-REST-Services-MVC4
使用MediaTypeFormatter和OData支持使用ASP.NET Web API構建和使用REST服務
將JSON.NET與ASP.NET Web API一起使用
http://blogs.msdn.com/b/henrikn/archive/2012/02/18/using-json-net-with-asp-net-web-api.aspx
在ASP.NET Web API中為逗號分隔值(CSV)格式創建自定義CSVMediaTypeFormatter
在ASP.NET Web API中實現CORS支持
我如何看待Web API
您可以使用完全不同的項目來托管Web API控制器。 但在這種情況下,您需要考慮部署。
Web API只是一個Web項目。 它將有自己的配置文件。 它可能會在自己的工作進程中運行(取決於您如何部署它)。
因此,如果您將Web API分區,那么您將獲得更大的靈活性,但最終可能會復制大量配置。
我的建議是,如果你這樣做,請確保兩個項目都與相同的基礎服務項目進行對話。 如果第三方可能使用此Web API,則分區也很有意義。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.