我有一个网络映射盘,盘符是Z:。在Z盘下面,放了一个assembly,名为test.dll。然后,我在VS2010中建立了一个.NET 4.0的工程,程序中有下面一段代码:
string dll = @"Z:\test.dll";
Assembly a = Assembly.LoadFrom(dll);
执行代码,抛出FileLoadException异常:Could not load file or assembly 'file:///Y:\bb\nvo_cas.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)。
深入到内部异常:An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.。
看来是.NET的安全机制阻止加载一个网络上(本地网或者互联网&#