Ambiguous HTTP method Actions require an explicit HttpMethod binding for Swagger 2.0


異常內容

NotSupportedException: Ambiguous HTTP method for action . 
Actions require an explicit HttpMethod binding for Swagger 2.0

解決方案

思考:瘋狂Google,找到 https://stackoverflow.com/questions/47822177/swagger-net-core-api-ambiguous-http-action-debugging, 但是底下沒有有價值的回答。自己琢磨一下,比起一個標准的接口,少了Http請求定義和參數定義。
猜測是因為定義不標准,對Swagger來說,不標准就報錯,這沒問題。
驗證:寫一個標准的method。

[HttpPost,Route(test)]
pulic void Test([FromBody] InputDto dto)
{
}

異常解決。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM