是否创建自托管Web API或使用Asp.Net Core Web API? [英] Create Self Hosted Web API or Use Asp.Net Core Web API?
问题描述
我有两个选择:
If I self host Wep Api uisng
OWIN/Katana
I can have the performance gain but as mentioned here, I have to write code to have the features ofIIS
like logging, application pool scaling, throttling etc.
我可以使用不使用不必要的System.Web
请求管道的Asp.Net Core
创建API吗?并使用IIS
功能或Nginx
服务器功能?
Instead can I create API using Asp.Net Core
which doesn't use unnecessary System.Web
request pipeline ? And use the IIS
features or Nginx
Server features ?
考虑到性能,哪个是最佳选择?
With performance in mind which is the best option ?
更新:
我的意思是,我不想使用IIS
,但是我想使用自定义代码自托管具有IIS
功能的Web API.还是Asp .NET Core可以帮助我在没有IIS和不必要的System.Web请求管道的情况下实现这一目标?
I mean , I don't want to use IIS
, but i want to self host Web API with IIS
features using custom code. or Will Asp .NET Core will help me to achieve this without IIS and unnecessary System.Web request pipeline ?
推荐答案
出于以下原因,我建议选择选项2,即ASP.NET Core Web API
I recommend option 2 i.e. ASP.NET Core Web API for following reasons
- 现在ASP.NET Core 2已经发布,它更加专注于更好的性能.您的API构建将是最少的(可以吸收应用程序中使用的内容). 可以以最有效的方式构建
- 核心Web API. .NET Core代码可以帮助您在非Windows计算机上进行部署.
- API响应足够快,因为避免了管道中的许多瓶颈.
- Now that ASP.NET Core 2 is out, it focused more on the better performance. Your API build will be minimal (takes in whats used in the application).
- Core Web API can be built in most efficient way. The .NET Core code can help you deploy on non-windows machines.
- API response is fast enough as lots of bottlenecks are avoided in the pipeline.
通过对Kestrel的改进,使用ASP.NET Core 2很有好处.WebAPI可以托管在IIS/Nginx上,也可以很容易地独立存在.
With Kestrel improvements, it beneficial to use ASP.NET Core 2. The Web API can be hosted on IIS/ Nginx or stand alone pretty easily.
这篇关于是否创建自托管Web API或使用Asp.Net Core Web API?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!