在 ASP.NET MVC 项目中将 ReportViewer 服务器控件与参数化服务器报表结合使用
我正在 ASP.NET MVC 项目中尝试使用 ReportViewer,效果很好。但是,当我在报表中引入参数时,ReportViewer 无法显示报表。换句话说,在 ReportViewer 中,您指定参数值并点击“查看报告”,但不会显示任何内容。我尝试使用 ReportViewer 从 ASP.NET WebForms 项目中检索具有相同参数值的相同报告,效果非常好。
我的报告是托管在 SQL Server 2008 R2 中的服务器 (rdl) 报告。
我的 MVC 项目与 这个问题的最佳答案,除了我使用带有参数的服务器报告。
错误是一个 JavaScript 错误,以下是完整的异常堆栈:
未捕获的异常: Sys.WebForms.PageRequestManagerParserErrorException: Sys.WebForms.PageRequestManagerParserErrorException:消息 无法解析从服务器收到的信息。线路抛出错误 869,Sys$WebForms$PageRequestManager$_endPostBack 中的第 12 列(错误, 执行者、数据)中 本地主机:63763/ScriptResource.axd?d=9h24dbJaaly3rGMpfScOygOpMl0i9ZEfurAVmwlb3Yl0rMGkCKy1xLKet_d0sBUJJ4e0MXKZS5XmIx-OivjpZk0ANc kormmfPEBQ-Afm2nzOCuVDyyfYtP5j0AZgct8H67Sb-su3x9adK7hL6Sr6mSRruPOfgpwkAx7FkQnNwxll0rK_eH5XspKF7I4bOja30&t=ffffffff940d030f: 抛出错误;从 Sys$WebForms$PageRequestManager$_parseDelta(executor) 中的第 1410 行第 12 列调用 本地主机:63763/ScriptResource.axd?d=9h24dbJaaly3rGMpfScOygOpMl0i9ZEfurAVmwlb3Yl0rMGkCKy1xLKet_d0sBUJJ4e0MXKZS5XmIx-OivjpZk0ANc kormmfPEBQ-Afm2nzOCuVDyyfYtP5j0AZgct8H67Sb-su3x9adK7hL6Sr6mSRruPOfgpwkAx7FkQnNwxll0rK_eH5XspKF7I4bOja30&t=ffffffff940d030f: this._endPostBack(this._createPageRequestManagerParserError(String.format(Sys.WebForms.Res.PRM_ParserErrorDetails, parserErrorDetails)), 执行器, );从第 1289 行第 8 列调用 Sys$WebForms$PageRequestManager$_onFormSubmitCompleted(发送者, 事件参数)中 本地主机:63763/ScriptResource.axd?d=9h24dbJaaly3rGMpfScOygOpMl0i9ZEfurAVmwlb3Yl0rMGkCKy1xLKet_d0sBUJJ4e0MXKZS5XmIx-OivjpZk0ANc kormmfPEBQ-Afm2nzOCuVDyyfYtP5j0AZgct8H67Sb-su3x9adK7hL6Sr6mSRruPOfgpwkAx7FkQnNwxll0rK_eH5XspKF7I4bOja30&t=ffffffff940d030f: var data = this._parseDelta(sender);通过 Function.prototype.apply() 从 () 中的第 47 行第 8 列调用 本地主机:63763/ScriptResource.axd?d=5kl0znaGl8mJnEQzUd91vqZhniJAoaXveYJu32ah4gLsmHOPWa96ICxMfSrJe-fpz4tHJdIFn_hkaL1FO-AADXzl-r RWgsT1CLV7B_tLY183SFpWsMANof_Lmsl3J9tuuHqYkhyJ_KZWOgebGYCVK5wpsX3XToZdY9wOAYQkNoVcAAlWiP-4bSDdiID80dex0&t=ffffffff940d030f: return method.apply(实例, 参数);从 (source, args) 中的第 3484 行第 16 列调用 本地主机:63763/ScriptResource.axd?d=5kl0znaGl8mJnEQzUd91vqZhniJAoaXveYJu32ah4gLsmHOPWa96ICxMfSrJe-fpz4tHJdIFn_hkaL1FO-AADXzl-r RWgsT1CLV7B_tLY183SFpWsMANof_Lmsl3J9tuuHqYkhyJ_KZWOgebGYCVK5wpsX3XToZdY9wOAYQkNoVcAAlWiP-4bSDdiID80dex0&t=ffffffff940d030f: evt[i](源,参数);从 Sys$Net$WebRequest$completed(eventArgs) 中的第 6364 行第 12 列调用 本地主机:63763/ScriptResource.axd?d=5kl0znaGl8mJnEQzUd91vqZhniJAoaXveYJu32ah4gLsmHOPWa96ICxMfSrJe-fpz4tHJdIFn_hkaL1FO-AADXzl-r RWgsT1CLV7B_tLY183SFpWsMANof_Lmsl3J9tuuHqYkhyJ_KZWOgebGYCVK5wpsX3XToZdY9wOAYQkNoVcAAlWiP-4bSDdiID80dex0&t=ffffffff940d030f: 处理程序(this._executor,eventArgs);从第 5984 行、() 中的第 16 列调用 本地主机:63763/ScriptResource.axd?d=5kl0znaGl8mJnEQzUd91vqZhniJAoaXveYJu32ah4gLsmHOPWa96ICxMfSrJe-fpz4tHJdIFn_hkaL1FO-AADXzl-r RWgsT1CLV7B_tLY183SFpWsMANof_Lmsl3J9tuuHqYkhyJ_KZWOgebGYCVK5wpsX3XToZdY9wOAYQkNoVcAAlWiP-4bSDdiID80dex0&t=ffffffff940d030f: _this._webRequest.completed(Sys.EventArgs.Empty);
在 Error$create(message, 错误信息)中 本地主机:63763/ScriptResource.axd?d=5kl0znaGl8mJnEQzUd91vqZhniJAoaXveYJu32ah4gLsmHOPWa96ICxMfSrJe-fpz4tHJdIFn_hkaL1FO-AADXzl-r RWgsT1CLV7B_tLY183SFpWsMANof_Lmsl3J9tuuHqYkhyJ_KZWOgebGYCVK5wpsX3XToZdY9wOAYQkNoVcAAlWiP-4bSDdiID80dex0&t=ffffffff940d030f: var err = 新错误(消息);从 Sys$WebForms$PageRequestManager$_createPageRequestManagerParserError(parserErrorMessage) 中的第 649 行第 8 列调用 在 本地主机:63763/ScriptResource.axd?d=9h24dbJaaly3rGMpfScOygOpMl0i9ZEfurAVmwlb3Yl0rMGkCKy1xLKet_d0sBUJJ4e0MXKZS5XmIx-OivjpZk0ANc kormmfPEBQ-Afm2nzOCuVDyyfYtP5j0AZgct8H67Sb-su3x9adK7hL6Sr6mSRruPOfgpwkAx7FkQnNwxll0rK_eH5XspKF7I4bOja30&t=ffffffff940d030f: var e = Error.create(displayMessage, {name: 'Sys.WebForms.PageRequestManagerParserErrorException'});打电话自 第 1410 行,第 12 列 Sys$WebForms$PageRequestManager$_parseDelta(执行器) 中 本地主机:63763/ScriptResource.axd?d=9h24dbJaaly3rGMpfScOygOpMl0i9ZEfurAVmwlb3Yl0rMGkCKy1xLKet_d0sBUJJ4e0MXKZS5XmIx-OivjpZk0ANc kormmfPEBQ-Afm2nzOCuVDyyfYtP5j0AZgct8H67Sb-su3x9adK7hL6Sr6mSRruPOfgpwkAx7FkQnNwxll0rK_eH5XspKF7I4bOja30&t=ffffffff940d030f: this._endPostBack(this._createPageRequestManagerParserError(String.format(Sys.WebForms.Res.PRM_ParserErrorDetails, parserErrorDetails)), 执行器, null);从第 1289 行第 8 列调用 在系统$WebForms$PageRequestManager$_onFormSubmitCompleted(发送者, 事件参数)中 本地主机:63763/ScriptResource.axd?d=9h24dbJaaly3rGMpfScOygOpMl0i9ZEfurAVmwlb3Yl0rMGkCKy1xLKet_d0sBUJJ4e0MXKZS5XmIx-OivjpZk0ANc kormmfPEBQ-Afm2nzOCuVDyyfYtP5j0AZgct8H67Sb-su3x9adK7hL6Sr6mSRruPOfgpwkAx7FkQnNwxll0rK_eH5XspKF7I4bOja30&t=ffffffff940d030f: var data = this._parseDelta(sender);通过 Function.prototype.apply() 从 () 中的第 47 行第 8 列调用 本地主机:63763/ScriptResource.axd?d=5kl0znaGl8mJnEQzUd91vqZhniJAoaXveYJu32ah4gLsmHOPWa96ICxMfSrJe-fpz4tHJdIFn_hkaL1FO-AADXzl-r RWgsT1CLV7B_tLY183SFpWsMANof_Lmsl3J9tuuHqYkhyJ_KZWOgebGYCVK5wpsX3XToZdY9wOAYQkNoVcAAlWiP-4bSDdiID80dex0&t=ffffffff940d030f: return method.apply(实例, 参数);从 (source, args) 中的第 3484 行第 16 列调用 本地主机:63763/ScriptResource.axd?d=5kl0znaGl8mJnEQzUd91vqZhniJAoaXveYJu32ah4gLsmHOPWa96ICxMfSrJe-fpz4tHJdIFn_hkaL1FO-AADXzl-r RWgsT1CLV7B_tLY183SFpWsMANof_Lmsl3J9tuuHqYkhyJ_KZWOgebGYCVK5wpsX3XToZdY9wOAYQkNoVcAAlWiP-4bSDdiID80dex0&t=ffffffff940d030f: evt[i](源,参数);从 Sys$Net$WebRequest$completed(eventArgs) 中的第 6364 行第 12 列调用 本地主机:63763/ScriptResource.axd?d=5kl0znaGl8mJnEQzUd91vqZhniJAoaXveYJu32ah4gLsmHOPWa96ICxMfSrJe-fpz4tHJdIFn_hkaL1FO-AADXzl-r RWgsT1CLV7B_tLY183SFpWsMANof_Lmsl3J9tuuHqYkhyJ_KZWOgebGYCVK5wpsX3XToZdY9wOAYQkNoVcAAlWiP-4bSDdiID80dex0&t=ffffffff940d030f: 处理程序(this._executor,eventArgs);从第 5984 行、() 中的第 16 列调用 本地主机:63763/ScriptResource.axd?d=5kl0znaGl8mJnEQzUd91vqZhniJAoaXveYJu32ah4gLsmHOPWa96ICxMfSrJe-fpz4tHJdIFn_hkaL1FO-AADXzl-r RWgsT1CLV7B_tLY183SFpWsMANof_Lmsl3J9tuuHqYkhyJ_KZWOgebGYCVK5wpsX3XToZdY9wOAYQkNoVcAAlWiP-4bSDdiID80dex0&t=ffffffff940d030f: _this._webRequest.completed(Sys.EventArgs.Empty);
我相信我的设置中缺少某些内容。同样,我的 web.config 与 这个。
I am trying out using ReportViewer in an ASP.NET MVC project, and it worked well. However, when I introduced a parameter in the report, the ReportViewer failed to display the report. In other words, In ReportViewer you specify the parameter value and hit 'View Report', but nothing is displayed. I tried out retrieving the same report with same parameter value from an ASP.NET WebForms project with ReportViewer, and it worked perfectly fine.
My report is a server (rdl) report hosted in SQL Server 2008 R2.
My MVC project is the same as the best answer of this question, except that I am using a server report with a parameter.
The error is a JavaScript error, here is the full exception stack:
Uncaught exception:
Sys.WebForms.PageRequestManagerParserErrorException:
Sys.WebForms.PageRequestManagerParserErrorException: The message
received from the server could not be parsed. Error thrown at line
869, column 12 in Sys$WebForms$PageRequestManager$_endPostBack(error,
executor, data) in
localhost:63763/ScriptResource.axd?d=9h24dbJaaly3rGMpfScOygOpMl0i9ZEfurAVmwlb3Yl0rMGkCKy1xLKet_d0sBUJJ4e0MXKZS5XmIx-OivjpZk0ANckormmfPEBQ-Afm2nzOCuVDyyfYtP5j0AZgct8H67Sb-su3x9adK7hL6Sr6mSRruPOfgpwkAx7FkQnNwxll0rK_eH5XspKF7I4bOja30&t=ffffffff940d030f:
throw error; called from line 1410, column 12 in Sys$WebForms$PageRequestManager$_parseDelta(executor) in
localhost:63763/ScriptResource.axd?d=9h24dbJaaly3rGMpfScOygOpMl0i9ZEfurAVmwlb3Yl0rMGkCKy1xLKet_d0sBUJJ4e0MXKZS5XmIx-OivjpZk0ANckormmfPEBQ-Afm2nzOCuVDyyfYtP5j0AZgct8H67Sb-su3x9adK7hL6Sr6mSRruPOfgpwkAx7FkQnNwxll0rK_eH5XspKF7I4bOja30&t=ffffffff940d030f:
this._endPostBack(this._createPageRequestManagerParserError(String.format(Sys.WebForms.Res.PRM_ParserErrorDetails,
parserErrorDetails)), executor, ); called from line 1289, column 8 in
Sys$WebForms$PageRequestManager$_onFormSubmitCompleted(sender,
eventArgs) in
localhost:63763/ScriptResource.axd?d=9h24dbJaaly3rGMpfScOygOpMl0i9ZEfurAVmwlb3Yl0rMGkCKy1xLKet_d0sBUJJ4e0MXKZS5XmIx-OivjpZk0ANckormmfPEBQ-Afm2nzOCuVDyyfYtP5j0AZgct8H67Sb-su3x9adK7hL6Sr6mSRruPOfgpwkAx7FkQnNwxll0rK_eH5XspKF7I4bOja30&t=ffffffff940d030f:
var data = this._parseDelta(sender); called via Function.prototype.apply() from line 47, column 8 in () in
localhost:63763/ScriptResource.axd?d=5kl0znaGl8mJnEQzUd91vqZhniJAoaXveYJu32ah4gLsmHOPWa96ICxMfSrJe-fpz4tHJdIFn_hkaL1FO-AADXzl-rRWgsT1CLV7B_tLY183SFpWsMANof_Lmsl3J9tuuHqYkhyJ_KZWOgebGYCVK5wpsX3XToZdY9wOAYQkNoVcAAlWiP-4bSDdiID80dex0&t=ffffffff940d030f:
return method.apply(instance, arguments); called from line 3484, column 16 in (source, args) in
localhost:63763/ScriptResource.axd?d=5kl0znaGl8mJnEQzUd91vqZhniJAoaXveYJu32ah4gLsmHOPWa96ICxMfSrJe-fpz4tHJdIFn_hkaL1FO-AADXzl-rRWgsT1CLV7B_tLY183SFpWsMANof_Lmsl3J9tuuHqYkhyJ_KZWOgebGYCVK5wpsX3XToZdY9wOAYQkNoVcAAlWiP-4bSDdiID80dex0&t=ffffffff940d030f:
evt[i](source, args); called from line 6364, column 12 in Sys$Net$WebRequest$completed(eventArgs) in
localhost:63763/ScriptResource.axd?d=5kl0znaGl8mJnEQzUd91vqZhniJAoaXveYJu32ah4gLsmHOPWa96ICxMfSrJe-fpz4tHJdIFn_hkaL1FO-AADXzl-rRWgsT1CLV7B_tLY183SFpWsMANof_Lmsl3J9tuuHqYkhyJ_KZWOgebGYCVK5wpsX3XToZdY9wOAYQkNoVcAAlWiP-4bSDdiID80dex0&t=ffffffff940d030f:
handler(this._executor, eventArgs); called from line 5984, column 16 in () in
localhost:63763/ScriptResource.axd?d=5kl0znaGl8mJnEQzUd91vqZhniJAoaXveYJu32ah4gLsmHOPWa96ICxMfSrJe-fpz4tHJdIFn_hkaL1FO-AADXzl-rRWgsT1CLV7B_tLY183SFpWsMANof_Lmsl3J9tuuHqYkhyJ_KZWOgebGYCVK5wpsX3XToZdY9wOAYQkNoVcAAlWiP-4bSDdiID80dex0&t=ffffffff940d030f:
_this._webRequest.completed(Sys.EventArgs.Empty);Error created at line 237, column 4 in Error$create(message,
errorInfo) in
localhost:63763/ScriptResource.axd?d=5kl0znaGl8mJnEQzUd91vqZhniJAoaXveYJu32ah4gLsmHOPWa96ICxMfSrJe-fpz4tHJdIFn_hkaL1FO-AADXzl-rRWgsT1CLV7B_tLY183SFpWsMANof_Lmsl3J9tuuHqYkhyJ_KZWOgebGYCVK5wpsX3XToZdY9wOAYQkNoVcAAlWiP-4bSDdiID80dex0&t=ffffffff940d030f:
var err = new Error(message); called from line 649, column 8 in Sys$WebForms$PageRequestManager$_createPageRequestManagerParserError(parserErrorMessage)
in
localhost:63763/ScriptResource.axd?d=9h24dbJaaly3rGMpfScOygOpMl0i9ZEfurAVmwlb3Yl0rMGkCKy1xLKet_d0sBUJJ4e0MXKZS5XmIx-OivjpZk0ANckormmfPEBQ-Afm2nzOCuVDyyfYtP5j0AZgct8H67Sb-su3x9adK7hL6Sr6mSRruPOfgpwkAx7FkQnNwxll0rK_eH5XspKF7I4bOja30&t=ffffffff940d030f:
var e = Error.create(displayMessage, {name: 'Sys.WebForms.PageRequestManagerParserErrorException'}); called from
line 1410, column 12 in
Sys$WebForms$PageRequestManager$_parseDelta(executor) in
localhost:63763/ScriptResource.axd?d=9h24dbJaaly3rGMpfScOygOpMl0i9ZEfurAVmwlb3Yl0rMGkCKy1xLKet_d0sBUJJ4e0MXKZS5XmIx-OivjpZk0ANckormmfPEBQ-Afm2nzOCuVDyyfYtP5j0AZgct8H67Sb-su3x9adK7hL6Sr6mSRruPOfgpwkAx7FkQnNwxll0rK_eH5XspKF7I4bOja30&t=ffffffff940d030f:
this._endPostBack(this._createPageRequestManagerParserError(String.format(Sys.WebForms.Res.PRM_ParserErrorDetails,
parserErrorDetails)), executor, null); called from line 1289, column 8
in Sys$WebForms$PageRequestManager$_onFormSubmitCompleted(sender,
eventArgs) in
localhost:63763/ScriptResource.axd?d=9h24dbJaaly3rGMpfScOygOpMl0i9ZEfurAVmwlb3Yl0rMGkCKy1xLKet_d0sBUJJ4e0MXKZS5XmIx-OivjpZk0ANckormmfPEBQ-Afm2nzOCuVDyyfYtP5j0AZgct8H67Sb-su3x9adK7hL6Sr6mSRruPOfgpwkAx7FkQnNwxll0rK_eH5XspKF7I4bOja30&t=ffffffff940d030f:
var data = this._parseDelta(sender); called via Function.prototype.apply() from line 47, column 8 in () in
localhost:63763/ScriptResource.axd?d=5kl0znaGl8mJnEQzUd91vqZhniJAoaXveYJu32ah4gLsmHOPWa96ICxMfSrJe-fpz4tHJdIFn_hkaL1FO-AADXzl-rRWgsT1CLV7B_tLY183SFpWsMANof_Lmsl3J9tuuHqYkhyJ_KZWOgebGYCVK5wpsX3XToZdY9wOAYQkNoVcAAlWiP-4bSDdiID80dex0&t=ffffffff940d030f:
return method.apply(instance, arguments); called from line 3484, column 16 in (source, args) in
localhost:63763/ScriptResource.axd?d=5kl0znaGl8mJnEQzUd91vqZhniJAoaXveYJu32ah4gLsmHOPWa96ICxMfSrJe-fpz4tHJdIFn_hkaL1FO-AADXzl-rRWgsT1CLV7B_tLY183SFpWsMANof_Lmsl3J9tuuHqYkhyJ_KZWOgebGYCVK5wpsX3XToZdY9wOAYQkNoVcAAlWiP-4bSDdiID80dex0&t=ffffffff940d030f:
evt[i](source, args); called from line 6364, column 12 in Sys$Net$WebRequest$completed(eventArgs) in
localhost:63763/ScriptResource.axd?d=5kl0znaGl8mJnEQzUd91vqZhniJAoaXveYJu32ah4gLsmHOPWa96ICxMfSrJe-fpz4tHJdIFn_hkaL1FO-AADXzl-rRWgsT1CLV7B_tLY183SFpWsMANof_Lmsl3J9tuuHqYkhyJ_KZWOgebGYCVK5wpsX3XToZdY9wOAYQkNoVcAAlWiP-4bSDdiID80dex0&t=ffffffff940d030f:
handler(this._executor, eventArgs); called from line 5984, column 16 in () in
localhost:63763/ScriptResource.axd?d=5kl0znaGl8mJnEQzUd91vqZhniJAoaXveYJu32ah4gLsmHOPWa96ICxMfSrJe-fpz4tHJdIFn_hkaL1FO-AADXzl-rRWgsT1CLV7B_tLY183SFpWsMANof_Lmsl3J9tuuHqYkhyJ_KZWOgebGYCVK5wpsX3XToZdY9wOAYQkNoVcAAlWiP-4bSDdiID80dex0&t=ffffffff940d030f:
_this._webRequest.completed(Sys.EventArgs.Empty);
I believe something is missing in my settings. Again, my web.config is the same as this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
阅读您链接的其他问题,我认为另一个区别是您没有包含以下内容。就我个人而言,我使用了类似的方法,但无法让 AsyncRendering 工作。
TLDR:将 AsyncRendering 设置为 false,例如:
Reading that other question you linked, I am presuming the other difference is you have not included the following. Personally I have used a similar approach and couldn't get AsyncRendering working.
TLDR: Set AsyncRendering to false like: