Closed xb594328980 closed 4 years ago
CORS ? 您使用的是哪个分支?
https://github.com/zhaopeiym/quartzui/blob/dev/QuartzNetAPI/Host/appsettings.json#L19 AllowedHosts 用来配置跨域访问的地址。我用dev分支测试 是没有问题的。
你可以调试下 https://github.com/zhaopeiym/quartzui/blob/dev/QuartzNetAPI/Host/Startup.cs#L42
@xb594328980
System.InvalidOperationException: Endpoint Host.Controllers.JobController.GetAllJob (Host) contains CORS metadata, but a middleware was not found that supports CORS. Configure your application startup by adding app.UseCors() 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.ThrowMissingCorsMiddlewareException(Endpoint endpoint) at Microsoft.AspNetCore.Routing.EndpointMiddleware.Invoke(HttpContext httpContext) at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext) at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider) at Host.Startup.<>c.<b__5_0>d.MoveNext() in C:\Users\Administrator\Desktop\quartzui-dev\QuartzNetAPI\Host\Startup.cs:line 91
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
HEADERS
Connection: keep-alive Content-Type: application/json Accept: application/json, text/plain, / Accept-Encoding: gzip, deflate, br Accept-Language: zh-CN,zh;q=0.9 Host: localhost:8100 Referer: http://localhost:8100/ User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36 Sec-Fetch-Mode: cors Sec-Fetch-Site: same-origin