EF降级:无法加载文件或程序集' EntityFramework'或其中一个依赖项

时间:2016-06-28 03:49:47

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

我一直得到下面的错误,为了天堂,我无法弄清楚为什么。除了升级到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。

1 个答案:

答案 0 :(得分:0)

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