是否创建自托管Web API或使用Asp.Net Core Web API?

编程入门 行业动态 更新时间:2024-10-25 07:33:07
本文介绍了是否创建自托管Web API或使用Asp.Net Core Web API?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有两个选择:

  • 如果我自己托管Wep Api uisng OWIN/Katana,我可以提高性能,但是如上所述在这里,我必须编写代码来具有IIS的功能,例如日志记录,应用程序池扩展,限制等.

  • 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?

    本文发布于:2023-11-15 04:13:22,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1591043.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:API   Web   Asp   Core   Net

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!