I am all of a sudden getting a "Parameter Not Valid" exception on my production IIS server (Reboot has since cleared the exception). I have a Telerik
report that has a PictureBox control which I use to show a users signature. The signature is stored on the SQL Server
as varbinary(max). I imported it using this code:
SET EmployeeSignature = (SELECT BulkColumn FROM OPENROWSET(
Bulk 'C:\Signatures\Justin.bmp', SINGLE_BLOB)AS BLOB)
EmployeeNumber = '999999'
I am rendering the report as a pdf like so:
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");
}
From everything I have read there seems to be a correlation with this particular exception and various flavors of image files, font files, etc. As I stated above, a reboot of the IIS server stopped the ecxception for now but I need to figure out the cause before it happens again. Or find a better way to show the user signature on a report. Any suggestions?
I'm getting the following exception when the report stops working:
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