錯誤如下
500 : {"Message":"出現錯誤。","ExceptionMessage":"已添加了具有相同鍵的項。","ExceptionType":"System.ArgumentException","StackTrace":" 在 System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)\r\n 在 System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)\r\n 在 System.Web.Http.Description.ApiExplorer.TryExpandUriParameters(IHttpRoute route, HttpParsedRoute parsedRoute, ICollection`1 parameterDescriptions, String& expandedRouteTemplate)\r\n 在 System.Web.Http.Description.ApiExplorer.PopulateActionDescriptions(HttpActionDescriptor actionDescriptor, IHttpRoute route, String localPath, Collection`1 apiDescriptions)\r\n 在 System.Web.Http.Description.ApiExplorer.PopulateActionDescriptions(IEnumerable`1 actionDescriptors, String actionVariableValue, IHttpRoute route, String localPath, Collection`1 apiDescriptions, HttpControllerDescriptor controllerDescriptor)\r\n 在 System.Web.Http.Description.ApiExplorer.ExploreRouteActions(IHttpRoute route, String localPath, HttpControllerDescriptor controllerDescriptor, Collection`1 apiDescriptions)\r\n 在 System.Web.Http.Description.ApiExplorer.ExploreRouteControllers(IDictionary`2 controllerMappings, IHttpRoute route)\r\n 在 System.Web.Http.Description.ApiExplorer.InitializeApiDescriptions()\r\n 在 System.Lazy`1.CreateValue()\r\n 在 System.Lazy`1.LazyInitValue()\r\n 在 Swashbuckle.Swagger.SwaggerGenerator.GetSwagger(String rootUrl, String apiVersion)\r\n 在 Swashbuckle.Application.SwaggerDocsHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)\r\n 在 System.Net.Http.HttpMessageInvoker.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)\r\n 在 System.Web.Http.Dispatcher.HttpRoutingDispatcher.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)\r\n 在 System.Net.Http.DelegatingHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)\r\n 在 System.Web.Http.HttpServer.<SendAsync>d__0.MoveNext()"}

是什么環節什么地方添加了重復項呢, 求解決方法或解決思路
uj5u.com熱心網友回復:
這個不是swagger報錯吧。檢查下你用到Dictionary Add的地方,是否插入相同鍵值。uj5u.com熱心網友回復:
主鍵重復了吧?sql里,設定了主鍵自增了沒
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/34665.html
標籤:ASP.NET
下一篇:正則運算式獲取值
