简体   繁体   English

无法加载文件或程序集“System.Web,Version = 4.0.0.0,Culture = neutral”或其依赖项之一。 访问被拒绝

[英]Could not load file or assembly 'System.Web, Version=4.0.0.0, Culture=neutral' or one of its dependencies. Access is denied

Seems like there are already 100s of questions like these.. I have search through quite many of them and they don't seem to suggest anything that I haven't tried yet. 似乎已经有100多个像这样的问题..我已经搜索了很多这些问题,他们似乎没有提出任何我尚未尝试的问题。

I get the error: 我收到错误:

Could not load file or assembly 'System.Web, Version=4.0.0.0, Culture=neutral,    PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Access is denied. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.IO.FileLoadException: Could not load file or assembly 'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Access is denied.

Source Error: 



Line 44:         private static IKernel CreateKernel()
Line 45:         {
Line 46:             var kernel = new StandardKernel();
Line 47:             try
Line 48:             { 

The above code is present in my Ninject Initializer. 上面的代码出现在我的Ninject Initializer中。

I have given " Everyone " Permissions on: 我已经给出了“ 每个人 ”的权限:

C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319 C:\\ WINDOWS \\ Microsoft.NET \\框架\\ v4.0.30319

C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319 C:\\ WINDOWS \\ Microsoft.NET \\ Framework64 \\ v4.0.30319

C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\ .NETFramework C:\\ Program Files(x86)\\ Reference Assemblies \\ Microsoft \\ Framework \\ .NETFramework

FusionLog Details: FusionLog详细信息:

Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable  C:\Program Files (x86)\IIS Express\iisexpress.exe
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: DisplayName = System.Web, Version=4.0.0.0, Culture=neutral,    PublicKeyToken=b03f5f7f11d50a3a
(Fully-specified)
LOG: Appbase = file:///F:/TFS/MMSChange/Main/SMRH.MMSChange/SMRH.MMSChange.Web/
LOG: Initial PrivatePath = F:\TFS\MMSChange\Main\SMRH.MMSChange\SMRH.MMSChange.Web\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Found application configuration file     (F:\TFS\MMSChange\Main\SMRH.MMSChange\SMRH.MMSChange.Web\web.config).

I have also given everyone permissions on my code's folders. 我还给了每个人对我的代码文件夹的权限。 I have tried running ProcMon (which has helped me with the similar problems for different solutions before); 我试过运行ProcMon(以前帮助我解决了不同解决方案的类似问题); but it does not create a single entry for system.web.dll. 但它不会为system.web.dll创建单个条目。

I have impersonation built in. I use separate accounts to access the database and that impersonation for the database account breaks this. 我内置了模拟。我使用单独的帐户来访问数据库,并且模拟数据库帐户的模拟会破坏这一点。 Without impersonation the app runs fine. 没有模仿,应用程序运行正常。 (But has no data because all the db calls fail) (但没有数据,因为所有数据库调用都失败了)

Funny thing is though, if I deploy the same code to my local machine and run it via an IIS Web Site: it works. 但有趣的是,如果我将相同的代码部署到我的本地计算机并通过IIS网站运行它:它可以工作。 But if I just debug it from my IDE it fails. 但是,如果我只是从我的IDE调试它失败了。

Alright, so I found the solution. 好吧,所以我找到了解决方案。

After many hours of debugging and contacting Microsoft support, which yielded nothing. 经过几个小时的调试和联系Microsoft支持,没有产生任何结果。 I decided to start from scratch. 我决定从头开始。 I got another instance of ProcMon running and filtered results to show only IISExpress results (Since this is the one which is giving me error). 我得到另一个ProcMon运行实例并过滤结果只显示IISExpress结果(因为这是给我错误的那个)。

Then I compiled and launched my application from the IDE and waited for the error to come. 然后我从IDE编译并启动了我的应用程序,等待错误发生。 After I got the error, I filtered the results by " Access Denied ". 收到错误后,我通过“ 拒绝访问 ”过滤了结果。

Usually I filtered the results to look for system.web.dll, but this time i decided to ignore it. 通常我过滤结果以查找system.web.dll,但这次我决定忽略它。

I found that the only file which was throwing access denied was: " C:\\Users\\1roj1\\Documents\\IISExpress\\config\\aspnet.config " (Where 1roj1 is my user account). 我发现唯一丢弃拒绝访问权限的文件是:“ C:\\ Users \\ 1roj1 \\ Documents \\ IISExpress \\ config \\ aspnet.config ”(其中1roj1是我的用户帐户)。

I gave my impersonate user full access to this file and voila everything worked! 我让我的模仿用户完全访问了这个文件,并且一切正常!

I think you need to register .net Freamework 4.0 for IIS for the above issue. 我认为您需要为IIS注册.net Freamework 4.0以解决上述问题。 Here are the steps.. 这是步骤..

  1. Open Command prompt as Administrator 管理员身份打开命令提示
  2. Navigate to " C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319 " directory in command prompt [use the command cd C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319 ] 在命令提示符中导航到“ C:\\ Windows \\ Microsoft.NET \\ Framework \\ v4.0.30319 ”目录[使用命令cd C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319 ]
  3. Register .net FrameWork for IIS [use command aspnet_regiis.exe -i ] 注册.net FrameWork for IIS [使用命令aspnet_regiis.exe -i ]
  4. Restart IIS [use command iisreset ]. 重新启动IIS [使用命令iisreset ]。
  5. Done. 完成。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法加载文件或程序集'System,Version = 4.0.0.0,Culture = neutral'或其依赖项之一 - Could not load file or assembly 'System, Version=4.0.0.0, Culture=neutral' or one of its dependencies 无法加载文件或程序集'System,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = 561934e089'或其依赖项之一 - Could not load file or assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=561934e089' or one of its dependencies 无法加载文件或程序集“系统,版本=4.0.0.0,文化=中性,PublicKeyToken=b77a5c561934e089”或其依赖项之一 - Could not load file or assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies 无法加载文件或程序集“Npgsql,Version = 4.0.5.0,culture = neutral ...”或其依赖项之一。 仅发生在任务计划程序中 - Could not load file or assembly 'Npgsql, Version=4.0.5.0,culture=neutral…' or one of its dependencies. Only occurs in Task Scheduler 无法加载文件或程序集'System.Data.Linq,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089'或其依赖项之一 - Could not load file or assembly 'System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies 无法加载文件或程序集“ System.Configuration,版本= 4.0.0.0,区域性=中性,PublicKeyToken = b03f5f7f11d50a3a”或其依赖项之一 - Could not load file or assembly 'System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies 无法加载文件或程序集“System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089”或其依赖项之一 - Could not load file or assembly 'System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies 无法加载文件或程序集“System.Runtime,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a”或其依赖项之一 - Could not load file or assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies 无法加载文件或程序集“System.IO,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a”或其依赖项之一 - Could not load file or assembly 'System.IO, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies 无法加载文件或程序集“Microsoft.SqlServer.Types, Version=12.0.0.0, Culture=neutral, PublicKeyToken=myKey”或其依赖项之一。 - Could not load file or assembly 'Microsoft.SqlServer.Types, Version=12.0.0.0, Culture=neutral, PublicKeyToken=myKey' or one of its dependencies.
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM