Recently the file upload fields on our site under development have stopped working. I think it was when we upgraded to ASP.NET Maker v2020.0.8. It lets me choose a file, then below the upload field it displays something like this:
File not found ResponsePlan.pdf 72.94 KB [Cancel]
Internal Server Error
The IIS log shows a status 500 for the POST /ASPNET/ContractsDB/api/jupload attempt, and the Windows Event Viewer, Application log has the following message for each attempt. I understand what it’s saying but I didn’t write the code it’s referring to.
Category: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware
EventId: 1
RequestId: 8000007f-0001-fa00-b63f-84710c7967bb
RequestPath: /ASPNET/ContractsDB/api/jupload
SpanId: |ec1a771-4df4662b5f0ec3b9.
TraceId: ec1a771-4df4662b5f0ec3b9
ParentId:
An unhandled exception has occurred while executing the request.
Exception:
System.InvalidOperationException: Endpoint AspNetMaker2020.Controllers.JUploadController.Post (AspNetMaker2020) contains authorization metadata, but a middleware was not found that supports authorization.
Configure your application startup by adding app.UseAuthorization() inside the call to Configure(…) in the application startup code. The call to app.UseAuthorization() must appear between app.UseRouting() and app.UseEndpoints(…).
at Microsoft.AspNetCore.Routing.EndpointMiddleware.ThrowMissingAuthMiddlewareException(Endpoint endpoint)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.EvaluateAndApplyPolicy(HttpContext context, CorsPolicy corsPolicy)
at Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.Invoke(HttpContext context, ICorsPolicyProvider corsPolicyProvider)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass4_1.b__2(HttpContext context)
at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task)