How do I implement Post([FromBody] IMessage msg) in my .Net Core 2.1 web api Controller?
Clash Royale CLAN TAG #URR8PPP How do I implement Post([FromBody] IMessage msg) in my .Net Core 2.1 web api Controller? I get the following exception when I send a simple JSON structure implementing the interface IMessage: Could not create an instance of type TestService2.IMessage. Type is an interface or abstract class and cannot be instantiated. Path 'Id', line 2, position 7. Action parameters by default have to be concrete classes that can be initialized by the model binder. Only custom model binders can be used to achieve what it is you are trying to do. – Nkosi Jul 27 at 14:53 My question would be Why do you want to use am interface for the model parameter? – Nkosi Jul 27 at 15:00 ...