- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我有以下设置:在应用程序负载均衡器 (AWS) 后面的几个 linux 容器(基于 aspnetcore 2.0.5 构建)中运行的 web api
正在使用 HttpClient 向此 api 发出请求的客户端。客户端正在并行运行对多个任务的调用。如果并行任务的数量增加,API 将开始抛出异常并显示消息“请求超时”。
调用栈是:
at Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines.PipeCompletion.ThrowFailed() at Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines.Pipe.GetResult(ReadResult& result) at Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines.Pipe.Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines.IReadableBufferAwaiter.GetResult() at Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines.ReadableBufferAwaitable.GetResult() at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.MessageBody.d__24.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Frame`1.d__2.MoveNext()
什么会导致此错误,谁在设置超时,我该如何进一步调查?
编辑:如果我尝试用 fiddler 捕获失败的请求,则不会再抛出错误(可能 fiddler 正在以较低的并行度打开连接)。
最佳答案
一个可能的原因是由于 I/O 绑定(bind)操作,您阻塞了 asp.net 线程。从问题描述来看,您的服务器似乎正在处理特定点的请求。除此之外,它无法做到这一点。
我认为如果您正确使用 Async/Await,那么您可以处理比当前限制更多的并发请求数。
还要检查一下,通过配置是否可以增加 Asp.Net 线程数。传统的 Asp.Net 支持这一点。不确定 Asp.Net Core 是否具有此功能。
最后,由于您在云端运行,请检查升级服务器配置的可行性。可能升级的配置将帮助您处理更多请求。显然这应该是最后的选择。首先关注使用现有硬件提高应用程序的性能。
关于c# - AspNetCore (Kestrel) 请求超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49167759/
我曾尝试在 net.core 文档(问题等)上搜索信息但没有结果。 代码更简单: [HttpGet()] [Route("dob")] public string dobTes
对于部署在单个 AWS EC2 主机上的 .NET Core 2.2 应用程序,我比较了 IIS 托管与普通 Kestrel 托管。 对于 IIS 配置,我遵循 MS documentation .
我使用.net core 2.1并将其发布到IIS 8.5。我很难理解 .NET 核心托管的概念。 program.cs 是 public class Program { public sta
我有一个新的 ASP.NET 5 项目并按如下方式设置 project.json; "frameworks": { "dnx451": { "dependencies
我正在努力完成以下任务:我有一个运行 gRPC 服务的 asp.net core 3.1。 在应用程序的生命周期中,我希望能够暂停/停止端点/服务器监听/接受请求,并在一段时间后恢复它。 只是为了澄清
我已使用示例默认值在 Visual Studio 2019 中创建了无状态服务(创建新项目 -> Service Fabric 应用程序 -> 命名项目和解决方案 -> 无状态 ASP.NET Cor
我已使用示例默认值在 Visual Studio 2019 中创建了无状态服务(创建新项目 -> Service Fabric 应用程序 -> 命名项目和解决方案 -> 无状态 ASP.NET Cor
我们正在尝试使用 VSCode 在 Mac 上编写 ASP.NET 应用程序。我们已经成功安装了 VSCode、DNX、Yeoman、Node.js 和 npm,以及 the ASP.NET guid
我确实遇到了红隼的一个奇怪问题。我无法上传超过红隼 MaxRequestBodySize 的多个文件。 当我试图阅读 this.Request.Form.Files.GetFiles() 时,预期的行
官方MS-documentation说如果我想在 linux 上托管一个 ASP.NET 核心应用程序,我应该在它前面放置一个 apache 或 nginx 反向代理。但是,我找不到任何我应该这样做的
通过 HTTP 和 Visual Studio 内部它工作正常。但是,当我尝试通过 HTTPS 访问端点时,我看到了这个错误,我不完全确定如何解决这个问题: info: Microsoft.AspNe
我已完成以下操作,但仍然无效。运行 dotnet myapp.dll 仍然显示它正在监听 http://localhost:5000 . 创建hosting.json 代码: { "server.
我正在尝试使用 kestrel 创建 Web 应用程序。本文中https://learn.microsoft.com/pl-pl/aspnet/core/fundamentals/servers/ke
我知道不建议将 Kestrel Web 服务器暴露给外界,但将 Kestrel 置于 IIS 之后所损失的性能并不是一件可以轻易忽略的事情。 (事实上 ,迁移到 .net core 可能会失去所有
我在带有 VS2017 (15.3.5) 的 Win 7 上使用 Asp.Net core 2.0.2。 我当前的 Kestrel 配置如下所示: return WebHost.CreateDefau
如何在 Linux/OSX 上以持久的方式运行 Kestrel 网络服务器?我能够按预期运行网络服务器: 红隼 但是,我还没有找到一种方法来让它持久化,即 k 红隼 & 进程开始然后立即停止。 最佳答
我正在学习如何在 ASP.NET Core 2 中工作,我遇到了一个相当烦人的问题。每当我运行我的应用程序时,Kestrel 服务器都会忽略我的端点配置,而是开始监听一个随机端口。不用说,这不是我所期
我们有一个 ASP.NET Core 2.x 应用程序,它实现了自定义中间件,充当另一个(基于 Java 的)服务器/应用程序前面的代理。在服务器请求完成之前,此应用程序/中间件的客户端经常中止/取消
我需要通知 systemd 我的服务已成功启动,启动后需要运行的任务要求服务器已经在监听目标 Unix域套接字。 我正在使用 IWebHost::Run 来启动服务器,这是一个阻塞调用。此外,我找不到
我有以下设置:在应用程序负载均衡器 (AWS) 后面的几个 linux 容器(基于 aspnetcore 2.0.5 构建)中运行的 web api 正在使用 HttpClient 向此 api 发出
我是一名优秀的程序员,十分优秀!