2012-04-17 26 views
7

這裏是堆棧跟蹤:無法加載文件或程序集「Microsoft.Web.Infrastructure」或其某個依賴項。訪問被拒絕

[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。

一切都很好,直到我添加新的查看沒有母版頁。發生什麼事?如何解決這個問題?

回答

5

我有這個相同的問題,事實證明,Visual Studio已鎖定有問題的.dll。重新啓動Visual Studio修復了這個問題,儘管我仍然不知道爲什麼它發生了。

+0

這也解決了同樣的問題,我也是... – Alex 2012-11-16 14:54:36

+0

非常感謝 - 經過大量的谷歌搜索,我遇到了這個,重新啓動VS,果然它開始工作了:) – Jen 2012-11-23 00:01:12

相關問題