无法加载文件或程序集

问题描述 投票:1回答:1

我有以下问题,当我试图第二次建立我的网站时,网页上显示了这个问题。当我第一次加载项目时,所有的功能都能正常工作,问题是当我关闭电脑后,我第二次启动项目。

System

Server Error in '/' Application.
Could not load file or assembly 'file:///C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\8414c445\dc4fe894\App_global.asax.7hmxt1lb.dll' or one of its dependencies. The system cannot find the file specified.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.FileNotFoundException: Could not load file or assembly 'file:///C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\8414c445\dc4fe894\App_global.asax.7hmxt1lb.dll' or one of its dependencies. The system cannot find the file specified.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Assembly Load Trace: The following information can be helpful to determine why the assembly 'file:///C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\8414c445\dc4fe894\App_global.asax.7hmxt1lb.dll' could not be loaded.


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].

Stack Trace:


[FileNotFoundException: Could not load file or assembly 'file:///C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\8414c445\dc4fe894\App_global.asax.7hmxt1lb.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, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
   System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +232
   System.Reflection.Assembly.Load(AssemblyName assemblyRef, Evidence assemblySecurity) +62
   System.CodeDom.Compiler.CompilerResults.get_CompiledAssembly() +119
   System.Web.Compilation.BuildProvider.CreateBuildResult(CompilerResults results) +74
   System.Web.Compilation.BuildProvider.GetBuildResult(CompilerResults results) +22
   System.Web.Compilation.ApplicationBuildProvider.GetGlobalAsaxBuildResult(Boolean isPrecompiledApp) +12028905
   System.Web.Compilation.BuildManager.CompileGlobalAsax() +52
   System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +341

[HttpException (0x80004005): Could not load file or assembly 'file:///C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\8414c445\dc4fe894\App_global.asax.7hmxt1lb.dll' or one of its dependencies. The system cannot find the file specified.]
   System.Web.Compilation.BuildManager.ReportTopLevelCompilationException() +76
   System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +631
   System.Web.Compilation.BuildManager.CallAppInitializeMethod() +38
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +758

[HttpException (0x80004005): Could not load file or assembly 'file:///C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\8414c445\dc4fe894\App_global.asax.7hmxt1lb.dll' or one of its dependencies. The system cannot find the file specified.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +552
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +122
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +737

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4110.0
c# asp.net iis load .net-assembly
1个回答
1
投票
when I turned off my computer and I start with the project by the second time

我怀疑你把它关掉了--但很多文件没有正确写回磁盘上......。

点出

错误是在 Temporary ASP.NET Files 目录--其中asp.net automatically 生成文件--这与您的代码无关(至少在大多数情况下)--但问题在于asp.net编译器。

一般的想法是

停止你使用的程序,并清除缓存和临时文件,然后再运行它们。

我遵循的步骤

我建议做什么步骤,清除缓存,让IISasp.netcs重新编译项目。停止制作临时文件的程序

  1. 检查C盘是否有空闲空间。
  2. 关闭所有Visual Studio程序
  3. 打开 "服务",停止IIS "万维网发布服务"

现在我们已经停止了主要的编译器,我们进入到 清除所有可能的缓存和临时文件. 对于删除使用一个程序(如总指挥官),以查看隐藏的文件也

  1. 清理asp.net临时目录 - >C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\ 这里的所有文件和目录以及所有 Temporary ASP.NET Files 在你的计算机上存在的,取决于你如何运行3264位项目--以及你使用的版本......

  2. 清除临时windows临时目录。输入 cd %temp% 并在那里删除所有的文件--留下你无法删除的锁定文件......

  3. 清理其他临时系统的windows目录,你可以找到在 c:\windows\temp

  4. 可选择清除 .vs 隐藏在您的项目目录下的缓存目录--这只是在您与visual studio和您的项目有问题和延迟的情况下。

现在让我们再次运行这些程序

  1. 再次运行 "服务",启动IIS "万维网发布服务"
  2. 运行visual studio,给他一秒钟时间重新编译需要的东西... ...

现在你的问题必须解决了。为了避免文件损坏,检查你的电脑是否有足够的可用空间,检查系统的日期时间,不要强制关机。同时检查你的硬盘是否有错误--打开一个命令提示符窗口。cmd 并运行 chkdsk c: /f 用于检查和修复任何错误。

关于临时目录

每个电脑上的临时目录都不一样。你可以在控制面板中找到它们

© www.soinside.com 2019 - 2024. All rights reserved.