[SOLVED] Could not load file or assembly 'System.Web, Version=, 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.

I get the error:

Could not load file or assembly ‘System.Web, Version=, 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=, 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.

I have given "Everyone" Permissions on:



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

FusionLog Details:

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=, Culture=neutral,    PublicKeyToken=b03f5f7f11d50a3a
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); but it does not create a single entry for 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. But if I just debug it from my IDE it fails.


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).

Then I compiled and launched my application from the IDE and waited for the error to come. 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.

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).

I gave my impersonate user full access to this file and voila everything worked!

Answered By – ArjaaAine

Answer Checked By – Mary Flores (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *