zhaopeiym / quartzui

基于Quartz.NET3.0的定时任务Web可视化管理。docker打包开箱即用、内置SQLite持久化、语言无关、业务代码零污染、支持 RESTful风格接口、傻瓜式配置
MIT License
1.52k stars 418 forks source link

问下作者,代码是否需要改动才可运行! #23

Closed xb594328980 closed 4 years ago

xb594328980 commented 4 years ago

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

Ran-snow commented 4 years ago

CORS ? 您使用的是哪个分支?

zhaopeiym commented 4 years ago

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