王鸿辉 发表于 2024-3-13 11:47:07

活字格嵌入其他系统的iframe内报错

GetMetadata2接口会返回以下报错;这种情况应该如何处理呢?

{"ClassName": "System.Exception","Message": "Invalid request with no permission.","Data": null,"InnerException": null,"HelpURL": null,"StackTraceString": "   at Forguncy.Server2.Controllers.HomeController.GetMetadata2Async(String pageName, Boolean isMobile)   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)   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>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)   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 ServerDesignerCommon.CodeEditor.CodeEditorMiddleware.InvokeAsync(HttpContext context)   at Forguncy.Server2.KatanaMiddleware.ProcessEngineMiddleware.InvokeAsync(HttpContext context, ICacheService cacheService)   at Forguncy.Server2.KatanaMiddleware.ReportsMiddleware.InvokeAsync(HttpContext context, ICacheService cacheService, IReportServerService reportServerService)   at Forguncy.KatanaMiddleware.ServerCommandMiddleware.InvokeAsync(HttpContext context)   at Forguncy.KatanaMiddleware.CustomApiMiddleware.InvokeAsync(HttpContext context)   at Forguncy.KatanaMiddleware.ConcurrentControllMiddleware.InvokeAsync(HttpContext context)   at Forguncy.Server2.KatanaMiddleware.StartPageMiddleware.InvokeAsync(HttpContext context)   at ForguncyServerCommon.HttpHeaderMiddlewareBase.InvokeAsync(HttpContext context)   at Forguncy.KatanaMiddleware.ExceptionTraceMiddleware.InvokeAsync(HttpContext context)","RemoteStackTraceString": null,"RemoteStackIndex": 0,"ExceptionMethod": null,"HResult": -2146233088,"Source": "Forguncy.Server2","WatsonBuckets": null}


robert 发表于 2024-3-13 11:47:08

本帖最后由 robert 于 2024-3-13 12:30 编辑

https://gcdn.grapecity.com.cn/showtopic-98950-1-1.html

Chrome浏览器版本80以后对于两个网站用IFrame集成有严格的安全策略,必须满足以下两个条件。
1. 必须两个网站都是 https,并且有有效证书
2. 必须启用HTTP SameSite。这个可以在 C:\Users\Public\Documents\ForguncyServer\GlobalConfig.xml 中修改

Erik.Xue 发表于 2024-3-13 17:07:16

您好,可以看到日志中有报错:"Message": "Invalid request with no permission."
原因是请求没权限导致,结合描述使用了iframe,所以,原因基本可以确定是iframe安全策略导致,比如iframe中的网页和外部页面有跨域问题。

可以参考楼上大佬的回复来解决哈。
页: [1]
查看完整版本: 活字格嵌入其他系统的iframe内报错