是否创建自托管Web API或使用Asp.Net Core Web API? [英] Create Self Hosted Web API or Use Asp.Net Core Web API?

查看:111
本文介绍了是否创建自托管Web API或使用Asp.Net Core Web API?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个选择:

  1. 如果我自己托管Wep Api uisng OWIN/Katana,我可以提高性能,但是如上所述

  1. 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 of IIS 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆