You are POSTing from the client:
await client.PostAsJsonAsync("api/products", product);
not PUTing.
Your Web API method accepts only PUT requests.
So:
await client.PutAsJsonAsync("api/products", product);
More Related Contents:
- How to use (get and set) httpcontext.current.Session in the class library, within MVC web api application? [duplicate]
- WCF vs ASP.NET Web API [closed]
- Handle ModelState Validation in ASP.NET Web API
- Multiple actions were found that match the request in Web Api
- Entity Framework Core: A second operation started on this context before a previous operation completed
- How to implement real time data for a web page
- Swagger UI Web Api documentation Present enums as strings?
- Set default global json serializer settings
- WebAPI StreamContent vs PushStreamContent
- Selectively use default JSON converter
- How to extend IdentityUser with custom property
- Where is HttpContent.ReadAsAsync?
- Return HTML from ASP.NET Web API
- Why is my ClaimsIdentity IsAuthenticated always false (for web api Authorize filter)?
- Returning http status code from Web Api controller
- ASP.NET Core API only returning first result of list
- How to prevent a single object property from being converted to a DateTime when it is a string
- Application_Error in global.asax not catching errors in WebAPI
- Effectively use async/await with ASP.NET Web API
- swagger-ui returns 500 after deployment
- Read HttpContent in WebApi controller
- WebAPI and ODataController return 406 Not Acceptable
- Web API – 405 – The requested resource does not support http method ‘PUT’
- ASP.NET Web API and [Serializable] class
- C# unsupported grant type when calling web api
- ASP.NET Web API ActionFilter example
- Disable *all* exception handling in ASP.NET Web API 2 (to make room for my own)?
- WCF Service or Web API [closed]
- jQuery posts null instead of JSON to ASP.NET Web API
- Web API complex parameter properties are all null