与中科院政策.NET当地组装加载失败 [英] .net local assembly load failed with CAS policy

查看:240
本文介绍了与中科院政策.NET当地组装加载失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们越来越以下组件加载错误。该组件从本地路径:\ Program Files文件\ ASWorx产品\ ASWorx \ BIN \ C装。这个问题是不是有与旧版本的二进制。我们派出了通过电子邮件新的二进制文件时出现的问题。构建设置不会改变。我们怎样才能解决这个问题?这个问题似乎是在Win7 32位机

 文件名:文件:/// C:\ Program Files文件\ ASWorx产品\ ASWorx \ BIN \ ASConnexDI.dll'---> System.NotSupportedException:试图从中会造成在.NET Framework的previous版本将沙盒装配一个网络位置加载程序集。此版本的.NET Framework不启用CAS策略默认情况下,所以此负载可能是危险的。如果这个负荷,不适合在沙箱的组件,请启用loadFromRemoteSources切换。请参阅http://go.microsoft.com/fwlink/?LinkId=155569以获取更多信息。

   在System.Reflection.RuntimeAssembly._nLoad(的AssemblyName文件名,字符串codeBase的,证据assemblySecurity,RuntimeAssembly locationHint,StackCrawlMark和放大器; stackMark,布尔throwOnFileNotFound,布尔forIntrospection,布尔SUP pressSecurityChecks)

   在System.Reflection.RuntimeAssembly.nLoad(的AssemblyName文件名,字符串codeBase的,证据assemblySecurity,RuntimeAssembly locationHint,StackCrawlMark和放大器; stackMark,布尔throwOnFileNotFound,布尔forIntrospection,布尔SUP pressSecurityChecks)

   在System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(的AssemblyName assemblyRef,证据assemblySecurity,StackCrawlMark和放大器; stackMark,布尔forIntrospection,布尔SUP pressSecurityChecks)

   在System.Reflection.RuntimeAssembly.InternalLoadFrom(字符串assemblyFile,证据securityEvidence,字节]散列值,AssemblyHashAlgorithm hashAlgorithm,布尔forIntrospection,布尔SUP pressSecurityChecks,StackCrawlMark和放大器; stackMark)

   在System.Reflection.Assembly.LoadFrom(字符串assemblyFile,证据securityEvidence)

   在System.Activator.CreateInstanceFromInternal(字符串assemblyFile,字符串typeName的,布尔IGNORECASE,的BindingFlags bindingAttr,粘合剂粘合,对象[]的args,CultureInfo的文化,对象[] activati​​onAttributes,证据securityInfo)

   在NeST.ICE.IOSystem.DIManager.InitializeDI()
 

解决方案

从错误消息链接>:

  

如果应用程序已经从网络复制,它被标记由Windows作为Web应用程序,即使它驻留在本地计算机上。您可以通过更改文件属性来更改名称,或者您可以使用元素授予大会充分信赖。作为一种替代方法,您可以使用UnsafeLoadFrom方法加载本地组件,操作系统已标记为已加载的网页。

尝试打开文件属性,然后单击阻止:

We are getting the following assembly load error. The assembly is loaded from the local path "C:\Program Files\ASWorx Products\ASWorx\Bin\". The problem is not there with the old version of the binary. The issue appears when we have sent the new binary through e-mail. Build settings are not changed. How can we correct the issue? The issue appears in Win7 32 bit machine

File name: 'file:///C:\Program Files\ASWorx Products\ASWorx\Bin\ASConnexDI.dll' ---> System.NotSupportedException: 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.

   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)

   at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)

   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks)

   at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)

   at System.Reflection.Assembly.LoadFrom(String assemblyFile, Evidence securityEvidence)

   at System.Activator.CreateInstanceFromInternal(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo)

   at NeST.ICE.IOSystem.DIManager.InitializeDI()

解决方案

From the link in the error message:

If an application has been copied from the web, it is flagged by Windows as being a web application, even if it resides on the local computer. You can change that designation by changing the file properties, or you can use the element to grant the assembly full trust. As an alternative, you can use the UnsafeLoadFrom method to load a local assembly that the operating system has flagged as having been loaded from the web.

Try opening the file properties and clicking 'Unblock':

这篇关于与中科院政策.NET当地组装加载失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆