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

  • Question

  • 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



    • Edited by Sai Pranav Thursday, April 16, 2020 2:54 PM
    • Moved by CoolDadTx Tuesday, April 21, 2020 1:58 PM ASP.NET related
    Thursday, April 16, 2020 2:17 PM

Answers

  • You have ASP.NET issues that should be addressed at the ASP.NET forums. There is a WebAPI forum there that you can post to for help.

    http://forums.asp.net/

    404 means not found is a catch 22 that normally means that it can't find the action method based on the url  and the data if any data is being posted that matches the signature of the action method. It could mean that your routing is wrong. It could be  that a file is not found, like a DLL. 

    Postman and Fiddler are not going to find the problem. I think you need to start using the VS debugger and use the browser to debug the WebAPI. 


    • Edited by DA924x Thursday, April 16, 2020 5:02 PM
    • Marked as answer by Sai Pranav Wednesday, April 22, 2020 4:53 PM
    Thursday, April 16, 2020 4:52 PM

All replies

  • You have ASP.NET issues that should be addressed at the ASP.NET forums. There is a WebAPI forum there that you can post to for help.

    http://forums.asp.net/

    404 means not found is a catch 22 that normally means that it can't find the action method based on the url  and the data if any data is being posted that matches the signature of the action method. It could mean that your routing is wrong. It could be  that a file is not found, like a DLL. 

    Postman and Fiddler are not going to find the problem. I think you need to start using the VS debugger and use the browser to debug the WebAPI. 


    • Edited by DA924x Thursday, April 16, 2020 5:02 PM
    • Marked as answer by Sai Pranav Wednesday, April 22, 2020 4:53 PM
    Thursday, April 16, 2020 4:52 PM
  • Hi Sai Pranav,
    Based on your descripton, could you share us which one is your real Http Status code,404 NotFound or 400 BadRequest?
    And please check whether your request url's port number is right or not by requesting get method in your EmpsController.
    Finally, please share your Emp model.
    Thank you for your understanding.
    Best Regards,
    Daniel Zhang


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, April 21, 2020 9:38 AM