IIS上的Angular 6 http发布到实体框架无法传递正文中的参数

问题描述 投票:0回答:1

Get请求正确显示基本框架函数,但是当我尝试执行Post时:

enter image description here

OnSubmit(evt) evt是形式组; Chrome调试器:

enter image description here

然后几行:( http绑定到httpclient)

enter image description here

实体框架POST代码:

    // POST api/Registration/NewUser/<registration object>
    [HttpPost]
    [Route("NewUser")]
    public string Post([FromBody]_Registration newUser)
    {
        var Id = Guid.NewGuid();
        newUser.RegistrationId = Id.ToString();  << Good to here, but newUser is null

使用Postman发送虚拟记录,该记录使其成为Post函数。计算Id,但是newUser为null,因此无法继续。

如何让它从请求的“正文”接收NewUser?

angular entity-framework-4 httpclient
1个回答
1
投票

你在URL有拼写错误,在//之后应该有/而不是单个:

http:/

应该

http://

© www.soinside.com 2019 - 2024. All rights reserved.