WEB API Net Core 2.1.14发布[FromBody]接收ObjectNULL

问题描述

当通过Visual Studio控制器中的post通过服务从服务发送参数时,NET Core 2.1.14出现问题,但是参数到达了空对象,但是从服务中,json包含正确的数据,这可能是什么碰巧,我到处走动。

通过服务致电控制器

public agregarDenuncia(Denuncia) {
    var url = this.urlBase + 'api/Denuncia/guardarDenuncia';
    return this.http.post(url,Denuncia).map(res => res.json());
     }

控制器

 [HttpPost]
 [Route("api/Denuncia/guardarDenuncia")]
public int guardarDenuncia([FromBody] DenunciaCLS2 oDenunciaCLS2)
{
    //JsonElement persona  public int guardarDenuncia([FromBody] DenunciaCLS2 Denuncia)
    int rpta = 0;    
    try

结果是对象DenunciaCLS2 = NULL

Json have parameters before send to controller

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)