Report Viewer error on export PDF or Excel from Azure Web Sites
Hi,
When I try to export any RDLC report on PDF or Excel I obtain the error:
[ArgumentException: Parameter is not valid.]
System.Drawing.Graphics.GetHdc() +1153145
Microsoft.ReportingServices.Rendering.RichText.LineBreaker.Flow(TextBox textBox, Graphics g, FontCache fontCache, FlowContext flowContext, Boolean keepLines, Single& height) +75
...
I Try with Microsoft.ReportViewer.WebForms.dll version 10.0.40219.329 (Report Viewer 2010) and with version 11.0.40219.329. (Report Viewer 2012).
The same code works on premises server or on "Azure Cloud Service" Web Instance.
Any help would be highly appreciated.
Thanks.
LQ
Hi,
This calls into an native GDI API, and that API returns an error code which translated to invalid parameter. I could see couple of customer cases on Premise environment as well. This better goes to ReportingService or GDI forums.
thanks,
Wei
Hi,
This calls into an native GDI API, and that API returns an error code which translated to invalid parameter. I could see couple of customer cases on Premise environment as well. This better goes to ReportingService or GDI forums.
thanks,
Wei
This is an issue with the ReportViewer on Azure Website platform. I have run into exactly the same scenario.
As the O.P. stated, it works in Azure Cloud Service, the issue in on Azure Website platform, so this is a platform dependent bug and therefore this should be the appropriate forum.
This was reported here: Previously reported issue and passed off and closed by the admins. As reported in that thread, the bug exists on the Azure Web Site platform, as the original poster explained. It does not occur in Azure services. This is a platform dependent bug, and should be addressed in this forum and not passed off as a ReportViewer bug or GDI bug, kicking the issue down the road where it will most likely not be addressed.
Hi. We'll have to look into this further and let you know. It will take a little time to set this up and check into it.
Thanks.
Jim Cheshire | Microsoft
Hi Mzerda,
Can you please past the full exception include call stacks here? And give us a simple project to reproduce this issue?
Thanks,
Wei
Hello
I am also getting this error when trying to render a PDF report.
Call stack pasted below.
Thanks
David
An unhandled exception was generated during the execution of the |
|
Hi Retne,
I have read the source code, and it called into a native API. To move further, can I have a repro?
Thanks,
Wei
Code to repro below:
Dim renderedBytes() As Byte
Dim reportType As String
Dim mimeType As String
Dim encoding As String
Dim streams() As String = Nothing
Dim deviceInfo As String
Dim warnings As Microsoft.Reporting.WebForms.Warning() = Nothing
renderedBytes = Nothing
reportType = "PDF"
mimeType = "application/pdf"
encoding = Nothing
deviceInfo = "<DeviceInfo><OutputFormat>PDF</OutputFormat><PageWidth>297mm</PageWidth><PageHeight>210mm</PageHeight><MarginLeft>5mm</MarginLeft><MarginRight>5mm</MarginRight><MarginTop>5mm</MarginTop><MarginBottom>5mm</MarginBottom></DeviceInfo>"
renderedBytes = ReportViewer1.LocalReport.Render(reportType, deviceInfo, mimeType, encoding, "PDF", streams, warnings)
System.Web.HttpContext.Current.Response.Clear()
System.Web.HttpContext.Current.Response.ContentType = mimeType
System.Web.HttpContext.Current.Response.AddHeader("content-disposition", "attachment; filename=FEE_SUMMARY.PDF")
System.Web.HttpContext.Current.Response.BinaryWrite(renderedBytes)
System.Web.HttpContext.Current.Response.End()
Hi,
I'm having the exact same problem with my starting project on Azure,
i must also add thei information : even the export button from the reportviewer control on the page gives exactly the same error message as when you use the render from code.
thanks
Hi Retne,
unfortunately, this code is not working. It even not pass the compilation. there is no rdlc specified, no data source specified, etc.
Thanks,
Wei
No worries, I have reproduced the problem myself. Will update you once I found the cause and solution.
Thanks,
Wei
I was gone for the weekend and happy to return and find others stepping in to assist in this issue -- thanks to all! Thanks also to the admins for the quick service in reproducing the problem!
I have been searching for a solution all day long (all my project depends on this) and by reading many different topics (including on oher reporting solutions) here was my conclusion:
the render pdf uses the gdi+ api, but that api need more permission than what we get in azure website rôle,
so i decided to convert my project into a web role for azure. And there, after many hours (thanks to the very very slow publishing process for web role), i managed to have the reportviewer render to pdf, bye bye the depressing "parameter is not valid"
from what i read the difference lies with the fact that web role can be configured with .net full trust
hope it helps
This makes sense. Usually, it this was due to assembly security, we use to get a securityexception. I will try to dig out the cause.
thanks,
Wei
Hello Digital Consult
I am glad you have found a workaround for your project however this does not work for me as I need to find a way of getting it working on the Azure Websites platform, I already have projects working OK on web roles.
Any help by others much appreciated.
Thanks
I understand, and converting my project was not my first choice either.
but from all i have read about different reporting solutions, i came to the point that making it work on Azure website may be impossible at this time, until Microsoft modify the website platform.
yesterday i also tried the reporting solution from telerik, which is stated to work in azure, and in Azure website it was not workign either.
Any news on a resolution to this problem?
Thanks
I am still in the process to get permission to debug this on the live servers.
thanks,
Wei
Hi WZhao
Are you any closer to getting permission to debug this problem.
Thanks
FYI: I am trying to move a site to Azure and am getting the exact same exception (the stack is identical).
This line of the stack got my attention:
Microsoft.ReportingServices.Rendering.ImageRenderer
The report has a logo on it which may be related.
Steve Wellens
I live debugged this issue with my repro. Here is my findings.
Reporting Service called into GDI, and finally failed with this call(CreateCompatibleDC(null)).
http://msdn.microsoft.com/en-us/library/windows/desktop/dd183489(v=vs.85).aspx
The CreateCompatibleDC function creates a memory device context (DC) compatible with the specified device. If this handle is NULL, the function creates a memory DC compatible with the
application's current screen.
Based on this MSDN description, instead of security issue, I believe this issue related to user profiles. Azure Web Role, the default application pool identity is Network Service. For Windows Azure Web Site, the default identity is a random generated account. This should makes the difference.
I am trying to create a case to test this, will keep you posted.
Thanks,
Wei
Wei,
It sounds like your are on the right track! Thanks for keeping us informed.
[EDIT] Would it make sense to open a support ticket?
Steve Wellens
Thanks Steve.
We have identified what happened. For security issue, Windows Azure Web Sites restricts the web application to access some system resources(Including GDI API). We are now tirage on this issue, and will update as soon as I have an update.
Thanks,
Wei
We are now tirage on this issue...
Tirage? I'm not sure what you meant.
Steve Wellens
yorengoy
Why was this marked as an answer?
It's not resolved and Microsoft is studying the issue.
Steve Wellens
Steve Wellens
Steve,
This was marked as answered months ago after Wei posted that this happen on-premise as well and was related to a GDI API call. It was after that time that more information surfaced, so I've unmarked it.
I believe that it was determined that this is caused by the fact that WAWS doesn't allow certain APIs, but I'll let Wei comment on that.
Jim Cheshire | Microsoft
It's definitely NOT resolved! From my understanding it's going to need Web Sites to loosen security settings so the control can make GDI calls or the control will need a hot-fix to find an alternative to making GDI calls for PDF rendering.
Also my understanding that Microsoft was working on a fix -- I hope I'm not mistaken. I think it is obvious by the number of people who have run into this issue (just in this thread alone), that this is a serious issue that needs a resolution.
Wei's last response mentioned something about "tirage"... I think he meant "triage" which would imply a forthcoming resolution (again, I hope I am not mistaken).
We are able to reproduce this issue locally, and knows what happened as well. We have an item tracking this issue, we will keep you posted on the status. but at this moment, we don't have to much to share what will go on.
Thanks,
Wei
For tracking purposes, I'm marking this as answered. We are tracking this issue internally.
Jim Cheshire | Microsoft
Is there any progress on this issue? Do you have a timesacale on a resolution?
Thanks
Is there anyway for us to track this issue, besides this thread?
Thank you,
Jim
Is there any progress on this issue or a workaround? It is holding up progress on a couple of our projects.
Thanks
David
I run into the same problem. Just as i was discovering the fast Azure Website deployment for dev/test.
Hope a solution will be there some time ssoon.
peter
-- Peter
hey guys, just to let you know we are watching this thread!
I have the same problem. It's been several months since this issue has been reported. Please do something, the PDF export feature is crucial for my website http://www.CanvasBM.com so if nothing happens this week I'm moving my website to the old hosting, which is much cheaper by the way for my 1000+ visitors per month. Azure is too expensive for me at this moment $30+/mo!
http://victorantos.com
After much wasted time and hair pulling I have arrived here to find out MS is at fault not my reportviewer. Hopefully they will play nice together soon. In the mean time I have a (not pretty) workaround for the saving to a PDF. I installed the free download CutePDF™ Writer by Acro Software, Inc on the computers that access the site and need to save the report to a PDF. Since your ReportViewer does print successfully from Azure this program will intercept the print and save it to a PDF file instead.
Hi Guys,
Same problem here. Any news?
Thanks
I'm having the same issue here using Telerik Reporting directly to PDF. Seems like the only work around is to convert my web application into a Cloud Service.
WZhao - You said that this is still on Microsoft's plate. Is this something that will be fixed within Azure Websites or are Cloud Services our only solution?
Thank you,
Shawn
I'm having the same problem. Not being able to render the ReportViewer "kills" the possibility of having a LOB app in Azure WebSites.
Is there an expected date for this to be solved?
I am seeing the same error. Is there an update for this issue or is there another thread that we can follow?
Thanks,
Garry
There are some intricacies involved in opening up this capability that will have to be dealt with before this will work, and there is no promise that those can be resolved. As of right now, we don't have any announcements to make.
Jim Cheshire | Microsoft
Jim
Thanks for the update. Very disappointed with your original answer that the the fix would not happen in the short term. Even more disappointed that you have changed your answer to say that a fix may never happen. It has taken 4 months to get to this position.
I am a big fan of Azure Web Sites but this news really causes a major problem for several of our projects. If I can use the ReportViewer PDF Export on Windows shared hosting platforms provided by most Hosting companies why I can I not use it on Azure Web Sites?
If a fix is not going to happen short term, or ever, what is your official advice for reporting on sites that are going to be deployed on Azure Web Sites, what is the work around or alternative. Are you saying Azure Web Sites is not suitable for any project that involve reports? Is there any other functionality that will not work on Azure Web Sites? Can you add this to the documetation so we don't waste our time deploying projects that are never going to work?
Regards
David
I did not intent to imply that this will never be addressed. Resolving this is in the long-term plans, but a fix won't happen in the short-term.
Thanks.
Jim Cheshire | Microsoft
I did not intent to imply that this will never be addressed. Resolving this is in the long-term plans, but a fix won't happen in the short-term.
Thanks.
Jim Cheshire | Microsoft
This issue was first brought to your attention in early July, last year, and just now you're saying this won't be resolved any time soon.
Let's just be frank here -- HUMONGOUS FAIL!!!
Jim
Thanks for the reply. Can you give me an idea what short term and long term mean? As I have previously stated this has been going on for 4 months already.
Regards
David
We don't have any announcements to make regarding timelines. All I can tell you is that it is on the long-term plan.
Jim Cheshire | Microsoft
Jim
I am not asking for an announcement, I simply want to understand what timeframe you mean when you say 'short term' and what time frame you mean when you say 'long term'. This will help me make some informed decisions. Is long term more than six months for example?
Also, can you explain why this is still a problem with the Reserved-Instance model when this uses a dedicated virtual machine.
Regards
David
Hi, David. I really can't give you a timeline, not because I'm trying to avoid it, but simply because we don't know. However, I can tell you that it's not likely to happen within six months.
This capability is not enabled in any scale mode for Windows Azure Web Sites. We don't have different feature sets in different staging modes.
Jim Cheshire | Microsoft
Hi,
I am trying to port a hosted application across to Azure Websites and have hit this problem with Reporting Services under Azure Websites.
We need to be able to produce invoices in pdf output format so that they're viewable on tablets and cannot be [easily] amended by the receiving customer.
Is there likely to be a solution in the near future or should I be looking at other reporting tools ?
Chris C.
Cloud Software
Hi, Chris. If you're looking for the ability to generate PDF files server-side via WAWS, it's not something that you can expect to be able to do within the next few months at least.
Jim Cheshire | Microsoft
Hi Chris
For producing invoices as PDF i would recommend using dox42 (www.dox42.com).
Right this week we released dox42 3.1 which can run on Azure Websites.
HTH + best regards
Christian
Because of this issue, I am now using Azure Reporting Services. Export to PDF is working, however export to Excel does not work when the report has a Chart.
I have created a new question for this issue, but I haven't received a reply. Are these exceptions related?
Thanks,
Garry
|