There are on the site warehouses, cash, movement. All this is loaded just fine. But there are also orders. I looked in the breakpoint, the data from the database is taken and after I in the action return the result return Content(HttpStatusCode.OK, result); after half a minute somewhere such an exception lights up An exception

What to do next, I don’t just know

    1 answer 1

    If suddenly you have a similar scenario, namely the case when you take data from the database and returns safely and after some time you get such an exception, check the problematic place (in my case action with orders) for the presence of a self referencing loop . Namely, you should use auxiliary models (ApiModels) in business logic instead of models (Models) that you use to store in the database.

    It’s like MVC separation of models into ViewModels and Models. Because I have a web api, then I called them ApiModels. If your database models have connections to other models, then do not use these models for output to the controllers. And never use better.