Je reçois l'erreur suivante lors de l'interrogation d'une recherche d'entité récursive.aspnetboilerplate interne erreur 500 sur la recherche d'entité récursive
Erreur:
{ "message": "Une erreur est survenue.", "ExceptionMessage": "Il y a un GetCategories d'action défini pour l'application/catégorie contrôleur api mais avec un autre HTTP Le verbe de requête est GET, il doit être Post "," exceptionType ":" System.Web.HttpException "," stackTrace ":" à Abp.WebApi.Controllers.Dynamic.Selectors.AbpApiControllerActionSelector.GetActionDescriptorByActionName (HttpControllerContext controllerContext, DynamicApiControllerInfo controllerInfo , String actionName) \ r \ n chez Abp.WebApi.Controllers.Dynamic.Selectors.AbpApiControllerActionSelector.SelectAction (HttpControllerContext controllerContext) \ r \ n à System.Web.Http.ApiController.ExecuteAsync (HttpControllerContext controllerContext, CancellationToken cancellationToken) \ r \ n à Castle.Proxies.DynamicApiController
1Proxy_5.ExecuteAsync_callback(HttpControllerContext controllerContext, CancellationToken cancellationToken)\r\n at Castle.Proxies.Invocations.ApiController_ExecuteAsync_5.InvokeMethodOnTarget()\r\n at Castle.DynamicProxy.AbstractInvocation.Proceed()\r\n at Abp.WebApi.Controllers.Dynamic.Interceptors.AbpDynamicApiControllerInterceptor
1.Intercept (invocation IInvocation) \ r \ n à Castle.DynamicProxy.AbstractInvocation.Proceed() \ r \ n à Castle.Proxies.DynamicApiController`1Proxy_5.ExecuteAsync (HttpControllerContext ControllerContext, CancellationToken cancellationToken) \ r \ n à System.Web.Http.Dispatcher.HttpControllerDispatcher.d__1.MoveNext() "}
Le erreur se produit uniquement après avoir ajouté la première entrée qui a un ParentId
Modèle
[Table("Categories")]
public class Category : FullAuditedEntity
{
[Required]
public string Name { get; set; }
[Required]
public string SharepointMapping { get; set; }
public int? ParentId { get; set; }
public Category Parent { get; set; }
public List<Category> Children { get; set; }
}
CategoryAppService
public ListResultDto<CategoryListDto> GetCategories(GetCategoriesInput input)
{
var categories = _categoryRepository
.GetAll()
.WhereIf(
!input.Filter.IsNullOrEmpty(),
p => p.Name.Contains(input.Filter)
)
.OrderBy(p => p.Name)
.ToList();
return new ListResultDto<CategoryListDto>(categories.MapTo<List<CategoryListDto>>());
}
CategoryListDto
[AutoMapFrom(typeof(Category))]
public class CategoryListDto : FullAuditedEntityDto
{
public string Name { get; set; }
public string SharepointMapping { get; set; }
public int? ParentId { get; set; }
public virtual Category Parent { get; set; }
}
Votre solution a résolu la moitié du problème pour vous aider à trouver la cause racine qui est l'erreur Json auto-référencée. –