Error phenomena:
An error occurred while reading the plugin: "An attempt was made to load an assembly from a network location in an earlier version of the. NET Framework, which results in sandboxed processing of the assembly." The. NET Framework for this release is not enabled by default for CAS policy, so this load can be dangerous. If this load is not sandboxed for the assembly, enable the loadfromremotesources switch. For more information, see http://go.microsoft.com/fwlink/?LinkId=155569. ”
Cause of error: A security mechanism that references an external dll,dotnet in a project prevents the loading of a assembly on a local network or on the Internet.
1, refer to https://msdn.microsoft.com/en-us/library/dd409252 (vs.100). aspx for resolution, configure App. Config to complete
<configuration> <runtime> <loadfromremotesources enabled= "true"/> </runtime ></configuration>
The 2,assembly class has a static function unsafeloadfrom, which does not perform some security checks when loading a assembly. The load DLL statement was modified to:
String dll = @ "Z:\test.dll";
Assembly a = assembly.unsafeloadfrom (DLL);
3, The assembly load method has a number of overloads that can be used with a load function with a parameter of byte[]. The code is as follows:
string dll = @ "Z:\test.dll";;
byte[] assemblybuffer = file.readallbytes (DLL);
Assembly a = assembly.load (assemblybuffer);
"Original http://blog.csdn.net/studying/article/details/6663627"
Assembly failure during DLL loading