2016-06-16 139 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目錄,這是導致錯誤的原因。