GET Requests works correctly, but when i try to post something i get "message=An internal error occurred during your request!" Error. This code works correctly MVC Web Api project, but not works on boilerplate.
public HttpResponseMessage Post(Contact contact)
{
contactRepository.SaveContact(contact);
var response = Request.CreateResponse(HttpStatusCode.Created, contact);
return response;
}
6 Answer(s)
-
0
Have you checked logs in web project's logs folder?
-
0
Hi,
It seems there is a JSON serialization problem. I think Contact is an entity. If so, returning entities may have serialization problems. Instead, we use DTOs (<a class="postlink" href="http://www.aspnetboilerplate.com/Pages/Documents/Data-Transfer-Objects">http://www.aspnetboilerplate.com/Pages/ ... er-Objects</a>). Also, you can add an Exception Handler to your project to catch the exception and check it in details (<a class="postlink" href="http://www.aspnetboilerplate.com/Pages/Documents/Handling-Exceptions#DocExceptionEvent">http://www.aspnetboilerplate.com/Pages/ ... ptionEvent</a>)
-
0
It doesn't work :cry: Do you have a sample for POST request working on boiler template?
-
0
Exception Handler returns this error message: "Processing of the HTTP request resulted in an exception. Please see the HTTP response returned by the 'Response' property of this exception for details."
-
0
Have you added exception event handler and checked the exception deeply? (<a class="postlink" href="http://www.aspnetboilerplate.com/Pages/Documents/Handling-Exceptions#DocExceptionEvent">http://www.aspnetboilerplate.com/Pages/ ... ptionEvent</a>)
Do you have a sample for POST request working on boiler template
Surely, sample applications does it. Example: <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate-samples/tree/master/SimpleTaskSystem">https://github.com/aspnetboilerplate/as ... TaskSystem</a>