Home Articles Details

AggregateException: One or more errors occurred. (The format of value) is invalid


Question: How do you resolve an error that says "AggregateException: One or more errors occurred. (The format of value) is invalid" in Asp.Net Core 7?

Login to See the Rest of the Answer

Answer: If you are using RestSharp to call a remote Web API or remote Service over HTTP and you happen to be sending the Json Payload in the Body of the Request, then this might be an issue.

This error simply tells you that the Recieving End of the API was not able to validate the format of the Payload. You need to provide the format of the Payload so the Recieving API knows how it should handle the Payload data. 
If you have the payload specified as

request.AddBody("data", Payload); then change it to  request.AddParameter("data", Payload, ParameterType.RequestBody);

Normally by adding:

request.AddHeader("Content-Type","application/json")

would resolve the issue, this is provided you have serialized the payload as JSON when sending it over the wire.


If you log in, you will be notified when someone leaves a comment.

Other users would like to know if this solution helped you.


© 2023 - ErnesTech LLC- Privacy