Base solution for your next web application
Open Closed

Tutorial 500 Error, No Exception Thrown, Cannot Use Swagger #2939


User avatar
0
justinp created

I'm following along the step-by-step tutorial (Core + Angular) and get to the point where you add a phone number. However, I get an error from the server.

Failed to load resource: the server responded with a status of 500 (Internal Server Error)
(unknown) ERROR: 
(unknown) Object
code:0
details:null
message:"An internal error occurred during your request!"
validationErrors:null

I set a break point and walk through the code no error is thrown by the server, but it fails at the equivalent line:

person.Phones.Add(phone);

If I set a breakpoint, it never reaches the next line:

await CurrentUnitOfWork.SaveChangesAsync();

When I use Swagger UI, my break point is never hit and I see the following response:

Response Body
{
  "result": null,
  "targetUrl": null,
  "success": false,
  "error": {
    "code": 0,
    "message": "**Current user did not login to the application!**",
    "details": null,
    "validationErrors": null
  },
  "unAuthorizedRequest": true,
  "__abp": true
}

Is there a way to test the API, or any reason that it would be failing without throwing an error? Does this have something to do with the method being Async?

Any help solving the issue or help to improve debugging is much appreciated.


2 Answer(s)
  • User Avatar
    0
    justinp created

    I went through in very extreme detail and made sure that all the properties were virtual and also noticed I had put my enum for Type inside the Phone class definition. I have no idea why this gave me the issue I saw, but this is resolved.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Thanks for sharing your solution. But normally this should not be the reason of your problem.

    Probably Logs.txt under your *.Web.Host project contains a detailed exception message.