iis运行后
系统的异常日志信息:
Category: Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer
EventId: 0
RequestId: 8000000d-0002-fb00-b63f-84710c7967bb
RequestPath: /api/PreventiveControl/InvestigationReport
SpanId: |59a79c8e-42f260deeaddb051.
TraceId: 59a79c8e-42f260deeaddb051
ParentId:
ActionId: 3fcb36ca-4b5e-42b2-a947-3ed62fa91e20
ActionName: SU.WebApi.Controllers.PreventiveControlController.InvestigationReport (SU.WebApi)
Increasing the MaxRequestBodySize conflicts with the max value for IIS limit maxAllowedContentLength. HTTP requests that have a content length greater than maxAllowedContentLength will still be rejected by IIS. You can disable the limit by either removing or setting the maxAllowedContentLength value to a higher limit.
当次异常信息抛出不久后.net rumtime貌似停止了工作:
具体信息:
Category: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware
EventId: 1
RequestId: 8000003a-0000-f500-b63f-84710c7967bb
RequestPath: /api/SugarAPI/UserLogin
SpanId: |59a79c9a-42f260deeaddb051.
TraceId: 59a79c9a-42f260deeaddb051
ParentId:
An unhandled exception has occurred while executing the request.
Exception:
System.InvalidOperationException: Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.
at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
at SU.Model.Result.EnumExtension.GetEnumText(Enum en) in D:\MyCode\API\SU\SU.Model\Result\EnumExtension.cs:line 24
at SU.WebApi.Controllers.SugarApiController.UserLogin(UserBaseParameter RequestParameter) in D:\MyCode\API\API\SU.WebApi\Controllers\SugarApiController.cs:line 75
at lambda_method(Closure , Object , Object[] )
at Microsoft.Extensions.Internal.ObjectMethodExecutor.Execute(Object target, Object[] parameters)
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task)
我找不到错误原因,请问我该如何定位??
无法定位。。。
按照这个错误信息
System.InvalidOperationException: Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.
将 Dictionary
改为 ConcurrentDictionary
shi'sh
是要修改程序代码吗?
@少年Dev: 是的
D:\MyCode\API\API\SU.WebApi\Controllers\SugarApiController.cs:line 75
↓
D:\MyCode\API\SU\SU.Model\Result\EnumExtension.cs:line 24
↓
System.InvalidOperationException: Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.
我查看了下好像D盘没这个路径哦
我猜服务器可能陷入这样一种情况,即 EF 在执行 linq 语句时同时更新和写入某种数据,然后让 Dictionary 陷入奇怪的状态,但我不知道如何防止这种情况以及真正的问题在哪里。这是 .NET 错误还是我自己的错误?
– 少年Dev 2年前