实体框架6.1.3无法加载

时间:2016-06-16 18:58:42

标签: entity-framework-6 servicestack .net-4.5

所以我看到了这个问题的一堆答案。似乎没有解决我的问题。我使用servicestack将项目作为自托管的Web服务运行。

  • 是的,我已经卸载并重新安装了实体框架,清理了解决方案,重新启动了visual studio,重建了
  • 是的,我已检查了所有绑定重定向。
  • 是的,我已检查过EntityFramework Dll是否在搜索dll的文件夹中。
  • 是的我对此文件夹有权限(出于绝望,我将项目放在我自己的桌面上以消除安全问题)。
  • 是的nuget包,项目和所有配置都有.net 4.5.1作为目标平台。

尽管如此,我仍然得到错误:

  

无法加载文件或程序集' EntityFramework'或其中一个依赖项。访问被拒绝。":" 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)。

1 个答案:

答案 0 :(得分:3)

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