ProducesErrorResponseTypeAttribute 類別

定義

指定以 標注的控制器預設所傳 ApiControllerAttribute 回的類型。

Type 指定當未提供任何值時,與用戶端錯誤相關聯的 ProducesResponseTypeAttribute 錯誤模型類型, (HTTP 狀態碼 4xx) 。 如果未指定任何值,MVC 會假設用戶端錯誤類型為 ProblemDetails ,如果使用將用戶端錯誤對應 (ClientErrorMapping) 。

如果您的應用程式使用自訂錯誤類型來回應,請使用此選項 Attribute 來設定預設錯誤類型。

public ref class ProducesErrorResponseTypeAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=false, Inherited=true)]
public sealed class ProducesErrorResponseTypeAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=false, Inherited=true)>]
type ProducesErrorResponseTypeAttribute = class
    inherit Attribute
Public NotInheritable Class ProducesErrorResponseTypeAttribute
Inherits Attribute
繼承
ProducesErrorResponseTypeAttribute
屬性

建構函式

ProducesErrorResponseTypeAttribute(Type)

初始化 ProducesErrorResponseTypeAttribute 的新執行個體。

屬性

Type

取得預設錯誤類型。

適用於