无法加载文件或程序集'Microsoft.Web.Infrastructure'或其某个依赖项。访问被拒绝。

7

以下是堆栈跟踪信息:

[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

一切都运行良好。我从未更改过我的引用。我在项目中添加了Microsoft.Web.Infrastructure.dll并将“Copy local”设置为True。

一切都很好,直到我添加了一个没有主页的新视图。发生了什么?如何解决?

1个回答

5

我曾经遇到过同样的问题,后来发现是Visual Studio锁住了相应的.dll文件。重新启动Visual Studio之后问题解决了,但是我仍然不知道为什么会出现这种情况。


非常感谢 - 经过大量的谷歌搜索,我找到了这个解决方法,重新启动 VS,确实又开始工作了 :) - Jen

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接