I have .net 3.5 program where i load some assemblies from a network share via reflection. Now i’ve got the following exception: “That assembly does not allow partially trusted callers’’(Detailed message below). The calling assembly(.exe) is local. This .exe loads the assembly from network via reflection. The assembly from the network share then has a reference on a third assembly which is located beneath the .exe. (Hard to explain, image will do better…)
The reason for this failure is the .net security. It doesn’t allow the MyLib.dll to be loaded, because the calling assembly is located on a network share and is signed with a strong name.
Allow all code to be executed using caspol. This might be dangerous, but if you’re desperate it could be a solution.
"C:\Windows\Microsoft.NET\Framework\v2.0.50727\CasPol.exe" -machine -chggroup All_Code FullTrust
No signing If you remove the signature from MyLib2.dll, everything works.
set attribute AllowPartiallyTrustedCallers If you set the AllowPartiallyTrustedCallers in the AssemblyInfo.cs of the signed assembly, everything works.
using System.Security; [assembly: AllowPartiallyTrustedCallers()]
caspol doku howto set fulltrust to a share Using Libraries from Partially Trusted Code Allowing Partially Trusted Callers