Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not load file or assembly 'Microsoft.Web.Infrastructure' or one of its dependencies. Access is denied

Here is the stack trace:

[FileLoadException: Could not load file or assembly 'Microsoft.Web.Infrastructure' or one of its dependencies. Access is denied.]

System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +39
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks) +132
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +144
System.Reflection.Assembly.Load(String assemblyString) +28
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +115

[ConfigurationErrorsException: Could not load file or assembly 'Microsoft.Web.Infrastructure' or one of its dependencies. Access is denied.]
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +1023
System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +346
System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +85
System.Web.Configuration.AssemblyInfo.get_AssemblyInternal() +54
System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +274
System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +63
System.Web.Compilation.BuildManager.CallPreStartInitMethods() +235
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +1109

[HttpException (0x80004005): Could not load file or assembly 'Microsoft.Web.Infrastructure' or one of its dependencies. Access is denied.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +762
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +156
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +357

Everything worked fine. I never changed anything in my references. I have Microsoft.Web.Infrastructure.dll added in my project and Copy local is set to True.

Everything was fine until I added new View without a master page. What is happening? How to resolve this?

like image 487
user1322207 Avatar asked Apr 17 '12 14:04

user1322207


1 Answers

I had this same problem, it turned out Visual Studio had locked the .dll in question. Restarting Visual Studio fixed the issue, though I still have no idea why it happened.

like image 184
Alejo Avatar answered Oct 02 '22 01:10

Alejo