Microsoft.ReportViewer.WebForms“不支持 iframes”

问题描述

我们的 MVC 应用程序中有一个基本页面,用于说明一些示例报告。直到最近它一直运行良好。基本上页面呈现了一些报告如下

@using reportviewerformvc;

@model Microsoft.Reporting.WebForms.ReportViewer

@if (!string.IsNullOrEmpty(ViewBag.ErrorMessage))
{
    <div class="alert alert-danger" role="alert">
        <strong>Error</strong> @ViewBag.Errormessage
    </div>
}
else
{
    @Html.ReportViewer(Model,new { @class = "report" })
}

最终调用以下 aspx 页面来呈现实际报告

<%@ Page Language="C#" AutoEventWireup="True" CodeBehind="ReportViewerWebForm.aspx.cs" Inherits="reportviewerformvc.ReportViewerWebForm" %>

<%@ Register Assembly="Microsoft.ReportViewer.WebForms,Version=15.0.0.0,Culture=neutral,PublicKeyToken=89845dcd8080cc91" Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">
        html,body,form
        {
            height: 100%;
            width: 100%;
        }

    </style>
</head>
<body style="margin: 0px; padding: 0px;">
    <form id="form1" runat="server">
        <asp:ScriptManager runat="server">
            <Scripts>
                <asp:ScriptReference Assembly="reportviewerformvc" Name="reportviewerformvc.Scripts.PostMessage.js" />
            </Scripts>
        </asp:ScriptManager>
        <rsweb:ReportViewer ID="ReportViewer1" runat="server" CssClass="report-viewer" Width="100%" Height="100%" 
            SizetoReportContent="False"></rsweb:ReportViewer>
    </form>
</body>
</html>

直到不久前这还可以正常工作,但现在 aspx 页面返回以下内容

<iframe class="report" src="/Robin/ReportViewerWebForm.aspx?id=9bf9d944-8446-4e1f-a563-85b13019714a">iframes not supported.</iframe><script src="/Robin/WebResource.axd?d=28PBhQV-RtkmV3d7Ni1Wu3-xhiHDwI8OXIFrf9MiE4xU1ux-xalZJYMJiQ02cnRQo1PRrhDd6a6hFl8Krcz96PmZGXFJ_UDiGdbuyM0LHNgksxlDrfs0jqaVW9_FUScDNa6ALMDZbPpWXa1EALnmPc8N6BLc0xZdDI2iWEV8U141&t=637493499768476239"></script><script>reportviewerformvc.setIframeId('9bf9d944-8446-4e1f-a563-85b13019714a');</script>

请注意,它最初使用的是 Microsoft.ReportViewer.WebForms 的第 11 版,我们更新到第 15 版希望能解决问题,但这并没有帮助。

有人知道发生了什么变化以及我们可以做些什么来修复它吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)