首先:我在用户控件中使用了 ASP.NET Report Viewer。我有以下用户控制:(aspx)
<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
<rsweb:ReportViewer InteractivityPostBackMode="AlwaysAsynchronous" ID="rVControl" ShowRefreshButton="false" SizeToReportContent="true" ShowPrintButton="true"
Width="50%" Height="100%" runat="server" Font-Names="Verdana" AsyncRendering="true" ProcessingMode="Remote"
Font-Size="8pt" WaitMessageFont-Names="Verdana" WaitMessageFont-Size="12pt">
</rsweb:ReportViewer>
在我后面的代码中:
public void LoadRVData() {
rVControl.ProcessingMode = ProcessingMode.Local;
rVControl.Visible = true;
LocalReport report = rVControl.LocalReport;
report.ReportPath = ReportPath;
ReportDataSource rvSource = new ReportDataSource(ReportSourceName, ReportSource);
report.DataSources.Clear();
report.DataSources.Add(rvSource);
}
一切正常,报告显示正确,但我有 elmah,它通过邮件向我发送以下错误:
System.FormatException: Input string was not in a correct format.
Generated: Wed, 08 May 2013 17:15:19 GMT
System.Exception: %23ECE9D8 is not a valid value for Int32. ---> System.FormatException: Input string was not in a correct format.
at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
at System.ComponentModel.Int32Converter.FromString(String value, NumberFormatInfo formatInfo)
at System.ComponentModel.BaseNumberConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
--- End of inner exception stack trace ---
at System.ComponentModel.BaseNumberConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
at System.Drawing.ColorConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
at System.Drawing.ColorTranslator.FromHtml(String htmlColor)
at Microsoft.Reporting.WebForms.BackgroundImageOperation.GetResource(String resourceName, String& mimeType, NameValueCollection urlQuery)
at Microsoft.Reporting.WebForms.EmbeddedResourceOperation.PerformOperation(NameValueCollection urlQuery, HttpResponse response)
at Microsoft.Reporting.WebForms.HttpHandler.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
我认为错误与某种颜色有关,但我没有在 rdlc 上放任何颜色...此外,在开发服务器上,报告加载速度非常快,但在生产环境中它有点慢,几乎 30 秒..
如果有人可以帮助解决这两个问题...,谢谢
PS该错误仅在Web应用程序处于生产状态而不是在开发服务器(Cassini)中时显示
编辑:错误地(正在将此 rv 控件的样式与另一个带有 firebug 的项目中的另一个控件的样式进行比较),我发现了问题所在。RV 控件创建一个 html 表和它具有工具栏的表的 td 之一。这个 td 有一个带有 url 的背景图片。现在它是 :
url("/myApplicationName/Reserved.ReportViewerWebControl.axd?OpType=BackImage&Version=11.0.3010.3&Color=%23ECE9D8&Name=Microsoft.Reporting.WebForms.Icons.toolbar_bk.png");
查看错误中的数字...。如果我删除“myApplicationName”一切正常,错误就会消失。所以它必须来自那里。问题:我没有在任何地方输入这个url,它是由reportviewer自动生成的,并且控件没有像工具背景图像这样的属性来改变这个......所以相对路径或绝对路径问题