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。

一切都很好,直到我添加了没有母版页的新视图。怎么了?如何解决这个问题?

4

1 回答 1

5

我遇到了同样的问题,原来 Visual Studio 已经锁定了有问题的 .dll。重新启动 Visual Studio 解决了这个问题,但我仍然不知道它为什么会发生。

于 2012-09-26T19:12:01.207 回答