SSRS External Assembly: Failed to load expression host assembly

While using external assembly, getting this message in SSRS Report in preview pane.

Failed to load expression host assembly. Details: That assembly does not allow partially trusted callers.

i've spent a day with this problem (initially started as #Error)

initially calling external assembly was fine. i would get the #Error whenever that external assembly was calling a web service. So i followed these directions, and added the code to add permission for calling a service with:

var urlRegEx = new Regex(@"http://mydevserver.com/.*");
var p = new WebPermission(NetworkAccess.Connect,urlRegEx);
p.Assert();

the p.Assert throws a security exception. so, the last step i did was to attempt to add full trust to the assembly that executes above code with:

cespol -af myAssembly.dll //after strongly signing it

that appeared to add full trust to it. but, now i am getting the above message.

not sure what the report is referring to as "Expression host assembly" and/or which assembly exactly is at fault here. I also followed directions in above link to add CodeGroups (url) for 2 assemblies referenced by my report, and added FullTrust to those as well using Microsoft Framework Configuration tool.

One important thing to consider is, initially i could at least execute some simple code in my referenced assembly, (only calling a webservice would cause #Error). But now, after adding that fulltrust, i can't do that anymore, and keep getting above error.

if i remove full trust from referenced assembly (using castol utility), and try to call calling p.Assert() in it, i get the following error:

SecurityException: Request for the permission of type SecurityPermission failed.

UPDATE

signing the assembly, is what is causing the main error in this post (Failed to load expression host assembly)


one way to get around this error

there is an attribute to allow partially trusted callers.

[assembly:AllowPartiallyTrustedCallers]

This still doesn't solve my bigger problem, but the error in this thread goes away.. need to do some more research. still not sure which "caller" is the partially trusted one, since my external assembly has full trust.

链接地址: http://www.djcxy.com/p/57492.html

上一篇: 防止黑客/反向

下一篇: SSRS外部程序集:无法加载表达式主机程序集