zoukankan      html  css  js  c++  java
  • 未能加载文件或程序集“***”或它的某一个依赖项,拒绝访问 <解决方法>

    报错信息如下:

    注:为了部分隐私安全需要,已将有问题文件名替换为filename,系统win2008R2,Microsoft .NET Framework 版本:4.0.30319; ASP.NET 版本:4.7.2623.0  

    “/”应用程序中的服务器错误。
    
    未能加载文件或程序集“filename”或它的某一个依赖项。拒绝访问。 
      说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 
    
     异常详细信息: System.IO.FileLoadException: 未能加载文件或程序集“filename”或它的某一个依赖项。拒绝访问。
    
    源错误: 
    
    
    执行当前 Web 请求期间生成了未经处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。  
    
    程序集加载跟踪: 下列信息有助于确定程序集“filename”未能加载的原因。
    
    
    
    警告: 程序集绑定日志记录被关闭。
    要启用程序集绑定失败日志记录,请将注册表值 [HKLMSoftwareMicrosoftFusion!EnableLog] (DWORD)设置为 1。
    注意: 会有一些与程序集绑定失败日志记录关联的性能损失。
    要关闭此功能,请移除注册表值 [HKLMSoftwareMicrosoftFusion!EnableLog]。
    
      
    
    堆栈跟踪: 
    
    
    
    [FileLoadException: 未能加载文件或程序集“filename”或它的某一个依赖项。拒绝访问。]
       System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
       System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +225
       System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +110
       System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +22
       System.Reflection.Assembly.Load(String assemblyString) +34
       System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +48
    
    [ConfigurationErrorsException: 未能加载文件或程序集“filename”或它的某一个依赖项。拒绝访问。]
       System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +729
       System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +247
       System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +157
       System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +226
       System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +73
       System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +321
       System.Web.Compilation.BuildManager.ExecutePreAppStart() +170
       System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +734
    
    [HttpException (0x80004005): 未能加载文件或程序集“filename”或它的某一个依赖项。拒绝访问。]
       System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +525
       System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +118
       System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +708
    
      
    
    
    版本信息: Microsoft .NET Framework 版本:4.0.30319; ASP.NET 版本:4.7.2623.0  

    第一开始尝试过给C:WindowsMicrosoft.NETFramework64v4.0.30319Temporary ASP.NET Files添加的everyone权限,无果,后又将其整个删除,依然无果。

    当然其中也尝试过其他一些方法,不过后来又到一一还原了,不具参考。

    简单来说,最后发现,就是报错显示的这个filename.dll(目录一般为你网站下的bin目录内)文件权限不够,需要给与添加everyone读取权限,

    不过事后,我在想截图留存一张清晰问题图片的事情,发现再把everyone的权限取消,iisreset访问也是ok没有任何问题的。

    完。祝各位一切顺利。

  • 相关阅读:
    心灵絮语(一)
    JavaScript基础之对象
    asp.net多线程(收藏)
    详解:数据库名、实例名、ORACLE_SID、数据库域名、全局数据库名、服务名
    凡事求个合理
    坐班一族快速消除疲劳七妙招
    电脑前保健攻略
    《孔子》都曰了些啥?
    幸福的来源不是财富的增长,而是欲望的降低
    [转]从一个男人关注的事情上 可以看出他的修养和抱负
  • 原文地址:https://www.cnblogs.com/hsia2017/p/8831335.html
Copyright © 2011-2022 走看看