My .net core webapi can't recognize the complex type RRS feed

  • Question

  • client:

      var data = {id:"1",name:"test"};










    public IActionResult Post(myType type)




    this response 500 code, when I plus [FromBody], response 415 code.

    vs 2017, 


    .net core 2.0

    I even don't know whether the data has been sent successfully or not.

    please help me , thank  you.

    • Moved by CoolDadTx Tuesday, March 13, 2018 1:46 PM ASP.NET related
    Tuesday, March 13, 2018 9:21 AM

All replies

  • First off when posting place your code into code blocks (second button from right on the toolbar).

    In regards to has data been sent or not?

    Install Fiddler is my first suggestion or work with Chrome developers tools. Either way these tools can be invaluable when performing a post. Perhaps you might (and this is a may be) there is a authorization issue.

    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Tuesday, March 13, 2018 9:39 AM
  • Thank you for Response me.

    I had installed the Fiddler, the response is 500 code

    and I change the type to Dynamic, 

    the break point is available, and It seems nothing in the dynamic parameter.

    how to sure whether the data has been sent successfully or not?

    one more thing, the Get Method in the API is running very well.

    Tuesday, March 13, 2018 9:55 AM
  • The 500 error code means that  the service through an exception, the exception was unhandled and the Web server swallowed the exception and through  the 500 error.

    The 415 is an Unexpected Media Type error that means that the service if WebAPI is expecting JSON as a datatype and that's not the datatype that has been sent to it.

    Your issues can be addressed in the WebAPI forum in ASP.NET forums.


    Tuesday, March 13, 2018 9:59 AM
  • but the .net core webapi give me nothing except response code, how to let webapi give me the error message
    Tuesday, March 13, 2018 10:11 AM
  • Are you trying to debug the solution using Visual Studio?

    Are you using IIS Express or local IIS?

    Have you deployed to the solution to IIS and it's now blowing up?

    Tuesday, March 13, 2018 12:30 PM
  • Please post questions related to ASP.NET and web development in the ASP.NET forums.

    Michael Taylor http://www.michaeltaylorp3.net

    Tuesday, March 13, 2018 1:46 PM
  • I am using iis express.
    Wednesday, March 14, 2018 12:41 AM
  • thank you for the warm explaining, 

    and what does the 400 response code mean?

    Wednesday, March 14, 2018 1:22 AM