【解决问题】加载网络映射盘中的assembly失败

我有一个网络映射盘,盘符是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的安全机制阻止加载一个网络上(本地网或者互联网&#

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值