I have a very simple report (a blank one actually with a title) that I am trying to export as a pdf file. If I run it from a console app with the same code, then it creates the pdf file correctly. If I try it from within a web page it crashes. Same report works fine in development from a web page, just in production it doesnt work.
Its obviously looking for something, but I cant work out what.
Anyone have any idea what could be missing?
The bin folder for the web app includes Telerik.Reporting.dll, as well as Telerik.ReportViewer.WebForms.dll just in case.
The stack trace is:
Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information. |
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. |
Exception Details: System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information. |
Source Error: |
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. |
Stack Trace: |
[ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.] |
System.Reflection.Module._GetTypesInternal(StackCrawlMark& stackMark) +0 |
System.Reflection.Assembly.GetTypes() +105 |
Telerik.Reporting.Processing.Expressions.NameSpaceResolver.Resolve(Assembly assembly) +14 |
Telerik.Reporting.Processing.Expressions.ExpressionContext.ResolveNameSpaces() +97 |
Telerik.Reporting.Processing.Expressions.ExpressionContext..ctor(Type methodInfoSourceType) +159 |
Telerik.Reporting.Processing.ReportProcessor.ProcessReport(IReportDocument reportDocument, String& documentName) +67 |
Telerik.Reporting.Processing.ReportProcessor.RenderReport(String format, IReportDocument reportDocument, Hashtable deviceInfo, CreateStream createStreamCallback, String& documentName) +263 |
Telerik.Reporting.Processing.ReportProcessor.RenderReport(String format, IReportDocument reportDocument, Hashtable deviceInfo) +108 |
CCConnect.TestPage.TestButton_Click(Object sender, EventArgs e) +197 |
System.Web.UI.WebControls.LinkButton.OnClick(EventArgs e) +111 |
System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +79 |
System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10 |
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13 |
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +175 |
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565 |
-------------------------------------------------------------------------------- |
Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053 |
protected void TestButton_Click(object sender, EventArgs e) |
{ |
TestReport r = new TestReport(); |
Hashtable deviceInfo = new Hashtable(); |
deviceInfo["FontEmbedding"] = "Subset"; |
Telerik.Reporting.Processing.ReportProcessor RP = new Telerik.Reporting.Processing.ReportProcessor(); |
byte[] buffer = RP.RenderReport("PDF", r, deviceInfo).DocumentBytes; |
string myPath = Properties.Settings.Default.MerchantRequestLocalPath; |
string pdfFile = myPath + @"\" + DateTime.Now.ToString("HHmmss") + ".pdf"; |
FileStream fs = new FileStream(pdfFile, FileMode.Create); |
fs.Write(buffer, 0, buffer.Length); |
fs.Flush(); |
fs.Close(); |
Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 01/02/2011 22:23:19
Event time (UTC): 01/02/2011 22:23:19
Event ID: bdee2576e7304b0caac8745211abaed7
Event sequence: 43
Event occurrence: 1
Event detail code: 0
Application information:
Application domain: /LM/W3SVC/488693489/Root-1-129410725642165128
Trust level: Full
Application Virtual Path: /
Application Path: F:\Orchestrator\Web Sites\Test\
Machine name: JR-ORCHESTRATOR
Process information:
Process ID: 5664
Process name: w3wp.exe
Account name: NT AUTHORITY\SYSTEM
Exception information:
Exception type: ExternalException
Exception message: A generic error occurred in GDI+.
Request information:
Request path: /Telerik.ReportViewer.axd
User host address: IP Address
User: sa
Is authenticated: True
Authentication Type: Forms
Thread account name: NT AUTHORITY\SYSTEM
Thread information:
Thread ID: 9
Thread account name: NT AUTHORITY\SYSTEM
Is impersonating: False
Stack trace: at System.Drawing.Image.Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams)
at System.Drawing.Image.Save(Stream stream, ImageFormat format)
at Telerik.Reporting.HtmlRendering.ChartRenderer.SaveImageInStream(HtmlRenderingContext context, Image image, String mimeType)
at Telerik.Reporting.HtmlRendering.ChartRenderer.RenderInternal(ProcessingElement processingElement, HtmlRenderingContext context)
at Telerik.Reporting.HtmlRendering.HtmlItemRender.Telerik.Reporting.HtmlRendering.IReportItemRender.Render(ProcessingElement processingElement, RenderingContext context)
at Telerik.Reporting.HtmlRendering.RenderingContext.Render(ReportItemBase item)
at Telerik.Reporting.HtmlRendering.Matrix.RenderInternal(HtmlRenderingContext context)
at Telerik.Reporting.HtmlRendering.Matrix.Render(HtmlRenderingContext context)
at Telerik.Reporting.HtmlRendering.ReportSectionBaseRenderer.RenderInternal(ProcessingElement processingElement, HtmlRenderingContext context)
at Telerik.Reporting.HtmlRendering.HtmlItemRender.Telerik.Reporting.HtmlRendering.IReportItemRender.Render(ProcessingElement processingElement, RenderingContext context)
at Telerik.Reporting.HtmlRendering.RenderingContext.Render(ReportItemBase item)
at Telerik.Reporting.HtmlRendering.HtmlPage.RenderReportSections(HtmlWriter bodyWriter)
at Telerik.Reporting.HtmlRendering.HtmlPage.RenderBody(HtmlWriter bodyWriter)
at Telerik.Reporting.HtmlRendering.HtmlPage.Render(HtmlTextWriter primaryWriter, HtmlRenderingContext renderingContext)
at Telerik.Reporting.HtmlRendering.HtmlReport.Render(HtmlTextWriter writer)
at Telerik.Reporting.HtmlRendering.HtmlRenderingExtension.Telerik.Reporting.Processing.IRenderingExtension.Render(Report report, Hashtable renderingContext, Hashtable deviceInfo, CreateStream createStreamCallback, EvaluateHeaderFooterExpressions evalHeaderFooterCallback)
at Telerik.Reporting.Processing.ReportProcessor.Render(IList`1 reports, ExtensionInfo extensionInfo, Hashtable renderingContext, Hashtable deviceInfo, CreateStream createStreamCallback)
at Telerik.Reporting.Processing.ReportProcessor.RenderReport(String format, IReportDocument reportDocument, Hashtable deviceInfo, Hashtable renderingContext, CreateStream createStreamCallback)
at Telerik.ReportViewer.WebForms.ServerReport.Render(HttpResponse response, String format, Int32 pageIndex)
at Telerik.ReportViewer.WebForms.ReportPageOperation.PerformOperation(NameValueCollection urlQuery, HttpContext context)
at Telerik.ReportViewer.WebForms.HttpHandler.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
CustomerFactory f =
new
CustomerFactory();
Telerik.Reporting.ReportParameter param1 =
new
Telerik.Reporting.ReportParameter();
param1.Name =
"CustomerName"
;
param1.Type = Telerik.Reporting.ReportParameterType.Integer;
param1.AllowBlank =
false
;
param1.Text =
"FirstName"
;
param1.Visible =
true
;
param1.MultiValue =
true
;
param1.AvailableValues.DataSource = f.GetCustomerNames();
param1.AvailableValues.ValueMember =
"=Fields.CustomerID"
;
param1.Value = 0;
this
.ReportParameters.Add(param1);
this
.DataSource = f.GetManyCustomers(
new
int
[] { Int32.Parse(
"=Parameters.CustomerName.Value"
) });