Unable to run Post Verb on Postman or Fiddle (Web API on ASP.Net Core 2.1)

  • Thread starter Thread starter Sai Pranav
  • Start date Start date
S

Sai Pranav

Guest
I have created a new webapi project with core(version 2.1) and added the required verbs . But I am unable to test the verbs In postman or fiddle.


In postman I am getting error that could not get any response.

  • The server couldn't send a response:
    Ensure that the backend is working properly
  • Self-signed SSL certificates are being blocked:
    Fix this by turning off 'SSL certificate verification' in Settings > General
  • Proxy configured incorrectly
    Ensure that proxy is configured correctly in Settings > Proxy
  • Request timeout:
    Change request timeout in Settings > General

in fiddler I am getting


404 badrequest.


https://localhost:44314/api/Emps/


this is the json I am sending


{
"lname": "Test",
"fname": "Value",
"sal": 2300
}



below is the method.


// POST: api/Emps

[HttpPost]
public async Task<IActionResult> PostEmp([FromBody] Emp emp)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}
_context.Emp.Add(emp);
await _context.SaveChangesAsync();
return CreatedAtAction("GetEmp", new { id = emp.id }, emp);
}


Please guide me on this as I am new to webapi

Continue reading...
 
Back
Top