IProblemDetailsService.TryWriteAsync(ProblemDetailsContext) 方法

定义

ProblemDetails尝试使用已注册IProblemDetailsWriter的服务编写对当前上下文的响应。

public virtual System.Threading.Tasks.ValueTask<bool> TryWriteAsync (Microsoft.AspNetCore.Http.ProblemDetailsContext context);
abstract member TryWriteAsync : Microsoft.AspNetCore.Http.ProblemDetailsContext -> System.Threading.Tasks.ValueTask<bool>
override this.TryWriteAsync : Microsoft.AspNetCore.Http.ProblemDetailsContext -> System.Threading.Tasks.ValueTask<bool>
Public Overridable Function TryWriteAsync (context As ProblemDetailsContext) As ValueTask(Of Boolean)

参数

context
ProblemDetailsContext

ProblemDetailsContext与当前请求/响应关联的 。

返回

注解

注册 IProblemDetailsWriter 的服务将按顺序进行处理,并在以下情况下完成处理:

  • 其中一个报告响应已成功写入,或者。
  • 所有 IProblemDetailsWriter 操作都已执行,其中任何一个都无法成功写入响应。

适用于