Reporting Services with framework 4
-
Friday, April 13, 2012 8:13 AM
Hi,
I created a new project with framework 4, loading a custom assembly to populate certain fields of a report. The report was added using the method:
this.rpViewer.LocalReport.AddTrustedCodeModuleInCurrentAppDomain("tstDat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null");
This threw this exception related to enable the CAS policy. I found the trick adding the following node in app.config:
<runtime>
<NetFx40_LegacySecurityPolicy enabled="true"/>
</runtime>And it worked fine.
Now, the problem is that I have this other project originally created with framework 3. I was recently required to upgrade it to framework 4. This project has also custom assemblies to populate report data.
I also use AddTrustedCodeModuleInCurrentAppDomain to load the assembly so I added the NetFx40_LegacySecurityPolicy node to app.config but it keeps throwing the exception I've mentioned before.
I added also the node
<loadFromRemoteSourcesenabled="true"/>with the same result...I'm lost on that. It seems the problem is only in the upgraded project. Does anyone know how to solve it?
I can't use the default framework 4 sandboxing because I need the custom assembly static property to populate some data from the report viewer container form and sandboxing keeps this data in a different domain, so the exception is not thrown but the property is empty.
Thanks.
- Edited by rikarth Monday, April 16, 2012 11:12 AM

