问题
I'm using .Net 4.5 and ReportViewer 11 in local mode. My reports are rendered very slowly (10 min). I found in this post that adding <trust legacyCasModel="true" level="Full"/>
to web.config will solve the problem, and it did. Report render time went from 10 minutes to 10 seconds, but now my dynamic variables in other parts of the system don't work. This is the error:
Dynamic operations can only be performed in homogenous AppDomain.
Is there a way to set <trust legacyCasModel="true" level="Full"/>
or something with the same effect in only one page?
回答1:
Changing the .net framework to 3.5 will help you load your reports in half a time. You can give a try in your case.
回答2:
The latest in this issue can be found here https://connect.microsoft.com/VisualStudio/feedback/details/561679/reporting-services-using-parameter-for-dynamic-grouping-very-slow and it looks like it may be addressed in sql server 2012.
If you are not using 4.5 specific features rollback to 3.5 is the most feasible option. Since the cas setting is part of the web.config the option is not available on a per page basis
Consider building a one page sub site for your report page where the sub site is a separate application with a 3.5 app pool, might be worth a quick test
回答3:
It may not be possible to set trust level for one page only, however you could separate the page with ReportViewer
control to new web application and thus new application domain. This way the web.config changes only affect report viewer page.
This workaround also has some other benefits like:
- ability to scale reporting web site differently as it usually consumes lot of resources
- ability to turn session state off for main website for performance reasons and keep it turned on only in reporting as ReportViewer requires session state
回答4:
Please use following link for more information
https://codeontime.com/blog/2014/08/improving-performance-of-reports-in
Add:
<trust legacyCasModel="true" level="Full"/>
in Section: configuration/system.web of Webconfig. It helps to Improve report Performance by 10 Times. But effects dynamic objects in MVC projects.
来源:https://stackoverflow.com/questions/18737758/asp-net-reportviewer-very-slow-in-local-mode