[英]System.IO.FileNotFoundException: Could not load file or assembly 'name of assembly' or one of its dependencies
I was working on my web API using c# and vs 2022 and was publishing it on IIS.我正在使用 c# 和 vs 2022 研究我的 web API 并在 Z5DA5ACF416054EFB7E726BEC8 上发布它。 Everything was working perfectly until something was wrong with my vs 2022, so I had to go back to vs 2019. Suddenly, I can't publish my service anymore.一切都运行良好,直到我的 vs 2022 出现问题,所以我不得不将 go 回到 vs 2019。突然,我无法再发布我的服务了。 All I get is this error:我得到的只是这个错误:
Could not load file or assembly 'file:///C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\alnahrain\1aa8f4f2\2a3c0bfe\App_global.asax.xj9i95jy.dll' or one of its dependencies. The system cannot find the file specified.
stack trace:堆栈跟踪:
[FileNotFoundException: Could not load file or assembly 'file:///C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\alnahrain\1aa8f4f2\2a3c0bfe\App_global.asax.xj9i95jy.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) +12033769
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\alnahrain\1aa8f4f2\2a3c0bfe\App_global.asax.xj9i95jy.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\alnahrain\1aa8f4f2\2a3c0bfe\App_global.asax.xj9i95jy.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
What is this about?这是关于什么的? Is this related to downgrading to vs 2019?这与降级到vs 2019有关吗? What did I do wrong?我做错了什么?
I have seen similar error report.我看过类似的错误报告。 This was the workaround- Check the web.config file, and delete the following lines (example):这是解决方法 - 检查 web.config 文件,并删除以下行(示例):
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=X.X.X.X, Culture=xxxxxx, PublicKeyToken=xxxxxxxxxxxxxxx" warningLevel="x" compilerOptions="/langversion:x /nowarn:xxxx;xxxx;xxxx" />
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=x.x.x.x, Culture=neutral, PublicKeyToken=xxxxxxxxxxxxxxx" warningLevel="x" compilerOptions="/langversion:xx /nowarn:xxxxx /define:_MYTYPE=\"Web\" /optionInfer+" />
</compilers>
</system.codedom>
You could refer to this link: https://social.msdn.microsoft.com/Forums/en-US/8760b09c-ebab-488f-bd51-0ea25169ef52/error-could-not-load-file-or-assembly?forum=aspconfiganddeploy你可以参考这个链接: https://social.msdn.microsoft.com/Forums/en-US/8760b09c-ebab-488f-bd51-0ea25169ef52/error-could-not-load-file-or-assembly?forum =asp配置和部署
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.