c# - 无法加载文件或程序集临时 ASP.NET 文件

标签 c# asp.net .net .net-assembly

我正在使用 C# (.NET Framework 4) 在 ASP.NET 上开发一个网站。创建新网站项目后,我尝试运行该项目。但我收到以下错误:

Could not load file or assembly 'file:///C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\myfirst\159977c5\b9e740fc\App_global.asax.yfqtni9g.dll' or one of its dependencies. The system cannot find the file specified.

我已经浏览了下面的链接[并且都谈到了对文件夹的访问],但它对我没有帮助:(

https://stackoverflow.com/questions/10496875/could-not-load-file-or-assembly-file-c-windows-microsoft-net-framework-v4-0

https://stackoverflow.com/questions/784157/asp-net-corrupt-assembly-could-not-load-file-or-assembly-app-web

http://web.archive.org/web/20101023213019/http://www.yetanotherdeveloper.com/post/2008/08/10/Could-not-load-file-or-assembly-App_Web.aspx

我检查并授予“Temporary ASP.NET Files”及其子文件夹和 Users 用户组文件的完全访问权限。

程序集加载跟踪

<p>WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].</p>

堆栈跟踪

[FileNotFoundException: Could not load file or assembly 'file:///C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\myfirst\4ff7194b\2da62764\App_global.asax.h-eem9xt.dll' or one of its dependencies. The system cannot find the file specified.]
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.Assembly.Load(AssemblyName assemblyRef, Evidence assemblySecurity) +28
System.CodeDom.Compiler.CompilerResults.get_CompiledAssembly() +93
System.Web.Compilation.BuildProvider.CreateBuildResult(CompilerResults results) +60
System.Web.Compilation.BuildProvider.GetBuildResult(CompilerResults results) +16
System.Web.Compilation.ApplicationBuildProvider.GetGlobalAsaxBuildResult(Boolean isPrecompiledApp) +9118863
System.Web.Compilation.BuildManager.CompileGlobalAsax() +44
System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +265

[HttpException (0x80004005): Could not load file or assembly 'file:///C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\myfirst\4ff7194b\2da62764\App_global.asax.h-eem9xt.dll' or one of its dependencies. The system cannot find the file specified.]
System.Web.Compilation.BuildManager.ReportTopLevelCompilationException() +62
System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +421
System.Web.Compilation.BuildManager.CallAppInitializeMethod() +31
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +691

[HttpException (0x80004005): Could not load file or assembly 'file:///C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\myfirst\4ff7194b\2da62764\App_global.asax.h-eem9xt.dll' or one of its dependencies. The system cannot find the file specified.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9090876
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +97
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +258

如果这是一个重复的问题,请给我一个链接

感谢副词。 <h3>I got the Log as follows</h3> <pre> The operation was successful. Bind result: hr = 0x0. The operation completed successfully. Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll Running under executable C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe --- A detailed error log follows. === Pre-bind state information === LOG: User = John-PC\John LOG: DisplayName = Microsoft.VisualStudio.ComponentModelHost, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (Fully-specified) LOG: Appbase = file:///G:/WorkShop/HTML-CSS/ASP/MyFirst/ LOG: Initial PrivatePath = G:\WorkShop\HTML-CSS\ASP\MyFirst\bin LOG: Dynamic Base = C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\myfirst\159977c5 LOG: Cache Base = C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\myfirst\159977c5 LOG: AppName = b9e740fc Calling assembly : (Unknown). === LOG: This bind starts in default load context. LOG: Using application configuration file: G:\WorkShop\HTML-CSS\ASP\MyFirst\web.config LOG: Using host configuration file: LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config. LOG: Found assembly by looking in the GAC. LOG: Binding succeeds. Returns assembly from C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.VisualStudio.ComponentModelHost\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.ComponentModelHost.dll. LOG: Assembly is loaded in default load context. </pre>

我无法追踪任何错误。请帮助我....

最佳答案

我在尝试开始性能测试后遇到了类似的问题。 我删除了 system.web 中的 assemblyPostProcessorType 属性 > web.config 中的 compilation 元素,它再次工作。

 <system.web>
<compilation debug="false" targetFramework="4.5.1"  
            assemblyPostProcessorType="Microsoft.VisualStudio.Enterprise.Common.AspPerformanceInstrumenter, Microsoft.VisualStudio.Enterprise.AspNetHelper, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</system.web>

关于c# - 无法加载文件或程序集临时 ASP.NET 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13525211/

相关文章:

c# - 为什么使用ASP.NET从另一个页面返回后无法激发Page_Load-ergo史诗般的尴尬:)

c# - "DateTime?"在 C# 中是什么意思?

c# - Entity Framework Core 比较两个子集合属性

c# - 需要在触摸屏上点击两次才能单击 WPF 中的按钮

asp.net - 如何将 Azure 上的多个自定义域映射到同一服务器但不同的 URL?

c# - 将 xml 文件转换为 .doc 或 .ppt

c# - Json反序列化异常

c# - 如何将 'System.Windows.Media.Imaging.BitmapImage' 转换为 'System.Drawing.Image' ?

c# - 将文件放入 Request.Files

.net - 升级到 .NET 4.5,现在是 "value does not fall within the expected range"