asp.net-core - Startup of IHostedService's in ASP.NET Core
问题描述
Are container-registered IHostedService's started in parallell or sequential?
Are the startups waited on before accepting incoming request?
If the startup crashes, how can this be detected? It seem to swallow this.
If a service crashes during operation, can it be configured to restart automatically?
解决方案
经过一番研究,我想我可以自己回答其中的大部分问题:
- 它们似乎是按照注册的顺序开始的,而不是并行的。
- 不等待 StartAsync 并且在 StartAsync 完成之前处理请求(可以通过自定义中间件缓解)。
- 如果 StartAsync 崩溃,它将被忽视(我在某处读到的内容显然应该在未来的版本中修复)。
- 如果在操作过程中崩溃,这也会被忽视,而且我还没有找到使用配置重新启动它们的方法,尽管制作自定义管理器来重新启动它们应该相当容易。
推荐阅读
- node.js - 管理用户的多个连接
- javascript - Apache Cordova 和 noVNC 库,Map() 对象运行的问题
- finite-automata - 构建一个接受联合语言的 DFA
- xml - bash 到 xproc(unix 到 XML)
- excel - 比较供应商的报价 | 电子表格 | 条件格式 | 色标
- angular - Angular 中带有@HostListener 的自定义对话框
- matlab - Lqnonlin 错误的 f(x) 值
- java - 带有批处理的 Spring Boot 应用程序在 Amazon AWS Lambda 环境中不起作用
- c++ - leetcode 中的二叉树级顺序遍历
- pandas - pandas:如何根据月度数据计算年度通货膨胀率?