Back in RC1, I would do this:
[HttpPost]
public IActionResult Post([FromBody]string something)
{
try{
// ...
}
catch(Exception e)
When you want to return a JSON response in MVC .Net Core You can also use:
Response.StatusCode = (int)HttpStatusCode.InternalServerError;//Equals to HTTPResponse 500
return Json(new { responseText = "my error" });
This will return both JSON result and HTTPStatus. I use it for returning results to jQuery.ajax().