ProducesErrorResponseTypeAttribute 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
指定以 標注的控制器預設所傳 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 |
取得預設錯誤類型。 |
適用於
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應