2016-06-16 54 views
2

所以我看到了一堆这个问题的答案。似乎没有解决我的问题。我正在使用服务堆作为自己托管的web服务运行项目。实体框架6.1.3无法加载

  • 是的,我已经卸载并重新安装实体框架,清洁的解决方案,重新启动Visual Studio中,重建
  • 是的,我检查了所有绑定重定向。
  • 是的,我已检查该EntityFramework DLL是在该文件夹中搜索的DLL。
  • 是的我有这个文件夹的权限(绝望之余我把项目放在我自己的桌面上以消除安全问题)。
  • 是的nuget包,项目和所有的配置都有.net 4.5.1作为他们的目标平台。

尽管这一切,我仍然得到错误:

Could not load file or assembly 'EntityFramework' or one of its dependencies. Access is denied.":"EntityFramework"

=== Pre-bind state information === 
LOG: DisplayName = EntityFramework 
(Partial) 
WRN: Partial binding information was supplied for an assembly: 
WRN: Assembly Name: EntityFramework | Domain ID: 1 
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:/Users/MyUserName/Desktop/TempFolder/Web.MyProject.Service/bin/x86/Debug/ 
LOG: Initial PrivatePath = NULL 
Calling assembly : EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089. 
=== 
LOG: This bind starts in default load context. 
LOG: Using application configuration file: C:\Users\MyUserName\Desktop\TempFolder\Web.MyProject.Service\bin\x86\Debug\Web.MyProject.Service.vshost.exe.Config 
LOG: Using host configuration file: 
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:/Users/MyUserName/Desktop/TempFolder/Web.MyProject.Service/bin/x86/Debug/EntityFramework.DLL. 
ERR: A fatal error occurred when retrieving next codebase for download (hr = 0x80070005). 

任何人都可以点我的一些工具来跟踪问题的原因(除非你知道是什么问题;-D)。

回答

2

原来“访问被拒绝”并不是说谎。我正在使用的上下文是一个实际的EntityFramework上下文(继承自),它在构造函数中实现了一些模仿。模拟的用户不能访问bin目录,这是导致错误的原因。