Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Swagger Internal Server 500 Error #7227


User avatar
0
ervingayle created

I recently upgraded from v5.0 to v7.0 and it was quite a task. Everything seems to be loading fine. However swagger is giving me an error and I cannot figure out how to fix it. The contents of teh Logs.txt file is below: System.ArgumentException: Type provided must be an Enum. Parameter name: enumType at System.RuntimeType.GetEnumNames() at System.Enum.GetNames(Type enumType) at Enotch.EnotchVnext.Web.Swagger.SwaggerEnumParameterFilter.AddEnumSpec(Dictionary2 extensions, Type type, ISchemaRegistry schemaRegistry) at Enotch.EnotchVnext.Web.Swagger.SwaggerEnumParameterFilter.Apply(IParameter parameter, ParameterFilterContext context) at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.CreateParameter(ApiDescription apiDescription, ApiParameterDescription apiParameterDescription, ISchemaRegistry schemaRegistry) at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.<>c__DisplayClass11_0.<CreateParameters>b__1(ApiParameterDescription paramDesc) at System.Linq.Enumerable.WhereSelectListIterator2.MoveNext() at System.Collections.Generic.List1..ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source) at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.CreateParameters(ApiDescription apiDescription, ISchemaRegistry schemaRegistry) at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.CreateOperation(ApiDescription apiDescription, ISchemaRegistry schemaRegistry) at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.CreatePathItem(IEnumerable1 apiDescriptions, ISchemaRegistry schemaRegistry) at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.<>c__DisplayClass6_0.<CreatePathItems>b__2(IGrouping2 group) at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable1 source, Func2 keySelector, Func2 elementSelector, IEqualityComparer1 comparer) at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.CreatePathItems(IEnumerable1 apiDescriptions, ISchemaRegistry schemaRegistry) at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.GetSwagger(String documentName, String host, String basePath, String[] schemes) at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.<Invoke>d__6.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>d__3.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware.<Invoke>d__6.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.<Invoke>d__3.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Builder.RouterMiddleware.<Invoke>d__4.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.<Invoke>d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.<Invoke>d__7.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at IdentityServer4.Hosting.IdentityServerMiddleware.<Invoke>d__3.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.<Invoke>d__6.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at IdentityServer4.Hosting.BaseUrlMiddleware.<Invoke>d__3.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.AspNetZeroCore.Web.Authentication.JwtBearer.JwtTokenMiddleware.<>c__DisplayClass0_0.<<UseJwtTokenMiddleware>b__0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.AspNetZeroCore.Web.Authentication.JwtBearer.JwtTokenMiddleware.<>c__DisplayClass0_0.<<UseJwtTokenMiddleware>b__0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.<Invoke>d__6.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.<Invoke>d__7.MoveNext()


8 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    please see: https://github.com/aspnetzero/aspnet-zero-core/issues/2458#issuecomment-504867856

  • User Avatar
    0
    ervingayle created

    I updated this file that is mentioned but I still have the same error message.

  • User Avatar
    0
    maliming created
    Support Team

    I can't reproduce the problem you mentioned above with the demo project of Zero v7.0. You can download the Zero Demo project to check it out.

  • User Avatar
    0
    ervingayle created

    I did download the aspnetzero v7 zip file about a week ago and I did file compares. So while I believe the original zip works my solution is not working. Is there something else I can do to troubleshoot?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @ervingayle

    We got your project which you send via email and we will inform you when we find the problem.

    Thanks,

  • User Avatar
    0
    feloff created

    got the same error with first swagger check after updating. his solution might work for me... many thanks

    subsequent refresh gave the following error:

    INFO 2019-07-24 21:22:05,069 [47 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET http://0.0.0.0:22742/
    INFO 2019-07-24 21:22:05,074 [47 ] ft.AspNetCore.Routing.EndpointMiddleware - Executing endpoint 'insuralise.Web.Controllers.HomeController.Index (insuralise.Web.Host)' INFO 2019-07-24 21:22:05,075 [47 ] ore.Mvc.Internal.ControllerActionInvoker - Route matched with {action = "Index", controller = "Home", area = ""}. Executing action insuralise.Web.Controllers.HomeController.Index (insuralise.Web.Host) INFO 2019-07-24 21:22:05,075 [47 ] ore.Mvc.Internal.ControllerActionInvoker - Executing action method insuralise.Web.Controllers.HomeController.Index (insuralise.Web.Host) - Validation state: Valid INFO 2019-07-24 21:22:05,075 [47 ] ore.Mvc.Internal.ControllerActionInvoker - Executed action method insuralise.Web.Controllers.HomeController.Index (insuralise.Web.Host), returned result Microsoft.AspNetCore.Mvc.RedirectToActionResult in 0.0396ms. INFO 2019-07-24 21:22:05,075 [47 ] ft.AspNetCore.Mvc.RedirectToActionResult - Executing RedirectResult, redirecting to /Ui. INFO 2019-07-24 21:22:05,075 [47 ] ore.Mvc.Internal.ControllerActionInvoker - Executed action insuralise.Web.Controllers.HomeController.Index (insuralise.Web.Host) in 0.7216ms INFO 2019-07-24 21:22:05,076 [47 ] ft.AspNetCore.Routing.EndpointMiddleware - Executed endpoint 'insuralise.Web.Controllers.HomeController.Index (insuralise.Web.Host)' INFO 2019-07-24 21:22:05,076 [47 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 6.9385ms 302 INFO 2019-07-24 21:22:05,081 [47 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET http://0.0.0.0:22742/Ui
    INFO 2019-07-24 21:22:05,086 [47 ] ft.AspNetCore.Routing.EndpointMiddleware - Executing endpoint 'insuralise.Web.Controllers.UiController.Index (insuralise.Web.Host)' INFO 2019-07-24 21:22:05,087 [47 ] ore.Mvc.Internal.ControllerActionInvoker - Route matched with {action = "Index", controller = "Ui", area = ""}. Executing action insuralise.Web.Controllers.UiController.Index (insuralise.Web.Host) INFO 2019-07-24 21:22:05,095 [47 ] ore.Mvc.Internal.ControllerActionInvoker - Executing action method insuralise.Web.Controllers.UiController.Index (insuralise.Web.Host) - Validation state: Valid INFO 2019-07-24 21:22:05,669 [47 ] ore.Mvc.Internal.ControllerActionInvoker - Executed action method insuralise.Web.Controllers.UiController.Index (insuralise.Web.Host), returned result Microsoft.AspNetCore.Mvc.ViewResult in 574.3107ms. INFO 2019-07-24 21:22:05,673 [47 ] Core.Mvc.ViewFeatures.ViewResultExecutor - Executing ViewResult, running view Index. INFO 2019-07-24 21:22:05,676 [47 ] Core.Mvc.ViewFeatures.ViewResultExecutor - Executed ViewResult - view Index executed in 4.2552ms. INFO 2019-07-24 21:22:05,676 [47 ] ore.Mvc.Internal.ControllerActionInvoker - Executed action insuralise.Web.Controllers.UiController.Index (insuralise.Web.Host) in 589.0476ms INFO 2019-07-24 21:22:05,676 [47 ] ft.AspNetCore.Routing.EndpointMiddleware - Executed endpoint 'insuralise.Web.Controllers.UiController.Index (insuralise.Web.Host)' INFO 2019-07-24 21:22:05,676 [47 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 594.9533ms 200 text/html; charset=utf-8 INFO 2019-07-24 21:22:08,231 [47 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET http://0.0.0.0:22742/swagger/index.html
    INFO 2019-07-24 21:22:08,235 [47 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 4.5466ms 200 text/html INFO 2019-07-24 21:22:08,610 [50 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET http://0.0.0.0:22742/swagger/v1/swagger.json
    ERROR 2019-07-24 21:22:08,952 [50 ] nostics.DeveloperExceptionPageMiddleware - An unhandled exception has occurred while executing the request. System.ArgumentException: An item with the same key has already been added. Key: x-schema at System.Collections.Generic.Dictionary2.TryInsert(TKey key, TValue value, InsertionBehavior behavior) at System.Collections.Generic.Dictionary2.Add(TKey key, TValue value) at insuralise.Web.Swagger.SwaggerOperationFilter.Apply(Operation operation, OperationFilterContext context) in /Users/eloffs/Documents/Frederik Dev/insuralise 6.8.0/aspnet-core/src/insuralise.Web.Core/Swagger/SwaggerOperationFilter.cs:line 32 at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.CreateOperation(ApiDescription apiDescription, ISchemaRegistry schemaRegistry) at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.CreatePathItem(IEnumerable1 apiDescriptions, ISchemaRegistry schemaRegistry) at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable1 source, Func2 keySelector, Func2 elementSelector, IEqualityComparer`1 comparer) at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.GetSwagger(String documentName, String host, String basePath, String[] schemes) at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider) at Microsoft.AspNetCore.Routing.EndpointMiddleware.Invoke(HttpContext httpContext) at Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware.Invoke(HttpContext httpContext) at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext) at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context) at Abp.AspNetZeroCore.Web.Authentication.JwtBearer.JwtTokenMiddleware.<>c__DisplayClass0_0.<

  • User Avatar
    0
    feloff created

    Problem found - had a helper app service that had a public access modifier. Not sure why it caused it to bomb, but fixed when corrected to internal.

  • User Avatar
    0
    maliming created
    Support Team

    Related to https://github.com/aspnetzero/aspnet-zero-core/issues/2458