我突然在我的生产 IIS 服务器上收到“参数无效”异常(重新启动已清除异常)。我有一个Telerik
带有 PictureBox 控件的报告,我用它来显示用户签名。签名存储在SQL Server
as varbinary(max) 中。我使用以下代码导入了它:
SET EmployeeSignature = (SELECT BulkColumn FROM OPENROWSET(
Bulk 'C:\Signatures\Justin.bmp', SINGLE_BLOB)AS BLOB)
EmployeeNumber = '999999'
我将报告呈现为 pdf,如下所示:
public ActionResult PrintPoReport(string id)
{
var irs = new InstanceReportSource();
irs.ReportDocument = new LogisticsReports.PoHeader();
irs.Parameters.Add(new Parameter("PoID", id));
Telerik.Reporting.Processing.ReportProcessor rp = new Telerik.Reporting.Processing.ReportProcessor();
Telerik.Reporting.Processing.RenderingResult result = rp.RenderReport("PDF", irs, null);
byte[] contents = result.DocumentBytes;
return File(contents, "application/pdf", "P0 #" + id + ".pdf");
}
从我读过的所有内容来看,似乎与此特定异常以及各种图像文件、字体文件等有关。如上所述,IIS 服务器的重新启动暂时停止了异常,但我需要弄清楚因为在它再次发生之前。或者找到一种更好的方式在报告上显示用户签名。有什么建议么?
当报告停止工作时,我收到以下异常:
ArgumentException: Parameter is not valid.]
System.Drawing.Image.get_RawFormat() +1624719
Telerik.Reporting.PictureBox.set_Value(Object value) +145
LogisticsReports.PoHeader.InitializeComponent() +59097
ArctecLogisticsWebFiles.Controllers.LogisticsToolsController.PrintPoReport(String id) +64
lambda_method(Closure , ControllerBase , Object[] ) +127
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +264
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +39
System.Web.Mvc.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12() +129
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +826106
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +314
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +825328
System.Web.Mvc.Controller.ExecuteCore() +159
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +335
System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +62
System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +20
System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +54
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +469
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +375