【问题标题】:EF Downgraded: Could not load file or assembly 'EntityFramework' or one of its dependenciesEF 降级:无法加载文件或程序集“EntityFramework”或其依赖项之一
【发布时间】:2016-06-28 03:49:46
【问题描述】:

我一直收到下面的错误,看在老天的份上,我不知道为什么。除了升级到 Windows 10 之外,我没有进行任何更改。我已降级我的 EF 并升级以确保我有相同的版本,但没有解决。我已经尝试了所有选项,并自行托管了应用程序,但即便如此也无助于消除 Visual Studio 问题。

如果有任何建议,将不胜感激。

无法加载文件或程序集'EntityFramework' 或其依赖项之一。 该进程无法访问该文件,因为它正被另一个进程使用

描述:执行过程中发生了未处理的异常 当前的网络请求。请查看堆栈跟踪以获取更多信息 有关错误的信息以及它在代码中的来源。

异常详细信息:System.IO.FileLoadException:无法加载文件 或程序集“EntityFramework”或其依赖项之一。过程 无法访问该文件,因为它正被另一个进程使用。 (HRESULT 异常:0x80070020)

来源错误:

在执行过程中产生了一个未处理的异常 当前的网络请求。有关原产地和位置的信息 可以使用下面的异常堆栈跟踪来识别异常。

装配负载跟踪:以下信息可能有助于 确定无法加载程序集“EntityFramework”的原因。

=== 预绑定状态信息 ===

> LOG: DisplayName = EntityFramework  (Partial) WRN: Partial binding
> information was supplied for an assembly: WRN: Assembly Name:
> EntityFramework | Domain ID: 2 WRN: A partial bind occurs when only
> part of the assembly display name is provided. WRN: This might result
> in the binder loading an incorrect assembly. WRN: It is recommended to
> provide a fully specified textual identity for the assembly, WRN: that
> consists of the simple name, version, culture, and public key token.
> WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for
> more information and common solutions to this issue. LOG: Appbase =
> file:///C:/src/prjPptsWa/ LOG: Initial PrivatePath =
> C:\src\prjPptsWa\bin Calling assembly : (Unknown).
> === LOG: This bind starts in default load context. LOG: Using application configuration file: C:\src\prjPptsWa\web.config LOG: Using
> host configuration file:
> C:\Users\Documents\IISExpress\config\aspnet.config LOG: Using machine
> configuration file from
> C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
> LOG: Policy not being applied to reference at this time (private,
> custom, partial, or location-based assembly bind). LOG: Attempting
> download of new URL
> file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary
> ASP.NET Files/root/17d130d2/d3bf1590/EntityFramework.DLL. LOG:
> Attempting download of new URL
> file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary
> ASP.NET
> Files/root/17d130d2/d3bf1590/EntityFramework/EntityFramework.DLL. LOG:
> Attempting download of new URL
> file:///C:/src/prjPptsWa/bin/EntityFramework.DLL. LOG: Using
> application configuration file: C:\src\prjPptsWa\web.config LOG: Using
> host configuration file:
> C:\Users\Documents\IISExpress\config\aspnet.config LOG: Using machine
> configuration file from
> C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
> LOG: Post-policy reference: EntityFramework, Version=6.0.0.0,
> Culture=neutral, PublicKeyToken=b77a5c561934e089 ERR: Failed to
> complete setup of assembly (hr = 0x80070020). Probing terminated.

堆栈跟踪:

[FileLoadException: Could not load file or assembly 'EntityFramework' or one of its dependencies. The process cannot access the file because it is being used by another process. (Exception from HRESULT: 0x80070020)]

[FileLoadException: Could not load file or assembly 'EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The process cannot access the file because it is being used by another process. (Exception from HRESULT: 0x80070020)]
   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.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +36
   System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +152
   System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +77
   System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +21
   System.Reflection.Assembly.Load(String assemblyString) +28
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +38

[ConfigurationErrorsException: Could not load file or assembly 'EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The process cannot access the file because it is being used by another process. (Exception from HRESULT: 0x80070020)]
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +738
   System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +217
   System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +130
   System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +170
   System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +92
   System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +290
   System.Web.Compilation.BuildManager.ExecutePreAppStart() +157
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +531

[HttpException (0x80004005): Could not load file or assembly 'EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The process cannot access the file because it is being used by another process. (Exception from HRESULT: 0x80070020)]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9946132
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +90
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +261

更新:- 解决了我的问题,解决方法是删除映射并重新映射到另一个文件夹。由于某种原因,旧文件夹阻止了 dll 的加载。

【问题讨论】:

  • 您在发布此问题之前尝试过this
  • 我查看了所有链接

标签: c# .net asp.net-mvc entity-framework


【解决方案1】:

您的 EntityFramework DLL 正被系统中的另一个程序使用。这就是编译时无法在 bin 中加载此程序集的原因。我不知道哪个程序当前正在使用这个 dll。您的机器中是否安装了 Panda AV。如果是,请禁用它并尝试它是否有效。

【讨论】:

  • 有几个类似的问题link, link
  • 我已经删除了我的 EntityFramework,看看我是否收到了您无法删除 dll 的消息,因为它正被另一个进程使用,但它已被删除。一旦我重建它,dll又在那里。我停止了我所有的防病毒软件。
猜你喜欢
  • 2012-09-27
  • 1970-01-01
  • 2021-12-12
  • 2012-01-14
  • 1970-01-01
相关资源
最近更新 更多