首页 > 解决方案 > 为什么当我返回返回 JSON 时招摇给我 ISE 错误

问题描述

我有以下代码我不确定为什么 swagger 不喜欢它,我收到此错误 在此处输入图像描述

public JsonResult ProductsForTreeView(int? id)
        {
            var employees = from e in Context.ResponsibleParty
                            where (id.HasValue ? e.ProductKey == id : e.ProductKey == 0)
                            select new
                            {
                                id = e.ID,
                                Name = e.PartyName + " " + e.ProductCode,
                                hasChildren = (from q in Context.Products
                                               where (q.ID == e.ProductKey)
                                               select q
                                               ).Count() > 0
                            };

            return Json(employees.ToList());

        }

我收到这个错误

获取错误内部服务器错误 /swagger/v1/swagger.json

标签: asp.net-coremodel-view-controllerswagger

解决方案


推荐阅读