繁体   English   中英

无法加载文件或程序集

[英]Could not load file or assembly

当我在网页第二次向我显示此内容时尝试构建我的网站时,我遇到了以下问题。 我寻求解决方案,但我还没有得到它。 当我第一次加载项目时,所有功能都运行良好,问题是当我关闭计算机并第二次启动项目时。

有错误的图像

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
when I turned off my computer and I start with the project by the second time

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

指出

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

总体思路

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

我遵循的步骤

我建议执行什么步骤并清除缓存,以便 IIS/asp.net/cs 重新编译项目。 停止制作临时文件的程序

  1. 检查 C 驱动器上是否有可用空间。
  2. 关闭所有 Visual Studio 程序
  3. 打开“服务”并停止 IIS“万维网 Web 发布服务”

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

  1. Clear the asp.net temporary directory - > C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\ all files and directory here and all Temporary ASP.NET Files that exist on your computer depend how you run the project 32/64位-以及您使用的版本...

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

  3. 清除c:\windows\temp上的其他临时系统 windows 目录

  4. (可选)清除项目目录中的.vs隐藏缓存目录 - 仅当 Visual Studio 和项目存在问题和延迟时才会这样做

现在让 go 再次运行程序

  1. 再次运行“服务”并启动 IIS“全球 Web 发布服务”
  2. 运行视觉工作室,给他一秒钟重新编译需要的东西......

现在你的问题必须得到解决。 为避免文件损坏,请检查您的计算机是否有足够的可用空间,检查系统上的日期时间,不要强制关闭系统。 还要检查您的硬盘是否有错误 - 打开命令提示符 window cmd并运行chkdsk c: /f以检查并修复任何错误。

关于临时目录

每台计算机上的临时目录都不相同。 您可以在控制面板 | 上找到它们。 系统 | 系统属性 | 环境变量-> 在那里寻找TEMPTMP 当您键入cd %temp%您 go 到您的临时目录时,但是许多程序在不同的帐户下运行,例如 windows 有c:/windows/temp/

关于 asp.net 临时目录。 默认情况下,此目录位于c:\Windows\Microsoft.NET\Framework64\上(对于 64 位),您可以在其中找到版本,然后找到Temporary ASP.NET Files 这是您可以在web.config应用程序的 web.config 上更改的内容...

其他可能的原因

检查您的事件查看器,看看是否有任何行表明编译器崩溃!

Application: csc.exe Framework Version: v###### Description: The process was terminated due to an unhandled exception. Exception Info: System.IO.FileNotFoundException at Microsoft.CodeAnalysis.CSharp.CommandLine.Program.Main(System.String[])

在这种情况下,您可能在全局调用中使用任何非 asp.net 网络 function 或任何导致编译器挂起的错误...检查您的 web 是否正确 - 这里是编译器部分的示例:

  <system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs" 
      type="Microsoft.CSharp.CSharpCodeProvider, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
        <providerOption name="CompilerVersion" value="v4.0"/>
        <providerOption name="WarnAsError" value="false"/>
      </compiler>
    </compilers>
  </system.codedom>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM