现在,我保证我已经使用了这个。堆栈溢出对此问题约有4或5种解决方案。尽管如此,他们似乎都没有工作。我在一个MVC 3项目中使用EntityFramework 5(4.4)。这在过去运行良好,但是自从我打开这个项目(大约20天左右)以来已经有一段时间了。我刚刚卸载&重新安装了Sql Server 2008 R2 Express。从那以后我重新启动。另一个无法加载文件或程序集'EntityFramework
在我所有的cshtml文件中,我的@model行上都出现了一个underlineline错误。当我将鼠标移到它上面时,我看到以下内容:
ASP.NET运行时错误:无法加载文件或程序集'EntityFramework,Version = 4.4.0.0,Culture = neutral,PublicTokenKey = b77a5c561934e089'或其某个依赖项。访问被拒绝。
我已经通过软件包管理器控制台卸载并重新安装了EntityFramework软件包。我也通过nuget完成了它。我已经关闭并重新开放了视觉工作室。我已经删除了该引用,并通过浏览该DLL手动添加了该引用。
这个我的web.config条目如下:
[open tag]section name="entityFramework" type="System.Data.Entity, EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" [close tag]
任何一个有什么想法?
编辑1个FULL错误详细
Server Error in '/' Application.
Could not load file or assembly 'EntityFramework' or one of its dependencies. Access is denied.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.IO.FileLoadException: Could not load file or assembly 'EntityFramework' or one of its dependencies. Access is denied.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Assembly Load Trace: The following information can be helpful to determine why the assembly 'EntityFramework' could not be loaded.
=== Pre-bind state information ===
LOG: User = Unknown
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:/MercurialProjects/ProxySetup/ProxySetup/
LOG: Initial PrivatePath = C:\MercurialProjects\ProxySetup\ProxySetup\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\MercurialProjects\ProxySetup\ProxySetup\web.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:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/014aecc8/d1c2eaf7/EntityFramework.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/014aecc8/d1c2eaf7/EntityFramework/EntityFramework.DLL.
LOG: Attempting download of new URL file:///C:/MercurialProjects/ProxySetup/ProxySetup/bin/EntityFramework.DLL.
LOG: Using application configuration file: C:\MercurialProjects\ProxySetup\ProxySetup\web.config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
ERR: Failed to complete setup of assembly (hr = 0x80070005). Probing terminated.
Stack Trace:
[FileLoadException: Could not load file or assembly 'EntityFramework' or one of its dependencies. Access is denied.]
[FileLoadException: Could not load file or assembly 'EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. Access is denied.]
System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +39
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks) +132
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +144
System.Reflection.Assembly.Load(String assemblyString) +28
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +46
[ConfigurationErrorsException: Could not load file or assembly 'EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. Access is denied.]
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +618
System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +209
System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +130
System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +178
System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +94
System.Web.Compilation.BuildManager.CallPreStartInitMethods() +332
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +677
[HttpException (0x80004005): Could not load file or assembly 'EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. Access is denied.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9090988
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +97
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +258
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272
EDIT 2
每调试信息上面,我手动添加的所有DLL的应用程序使用到C:\ WINDOWS \微软。 NET \ Framework \ v4.0.30319 \ Temporary ASP.NET Files \ root \ 014aecc8 \ d1c2eaf7文件夹,因为这是最终引用的错误不断变化。
我没有看到ASPNET用户为C:\ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ Temporary ASP.NET Files \目录分配权限。我已经添加了:完全控制的IUSR,NETWORK,NETWORK SERVICE,IIS_USRS(\ IIS_ISURS)。我仍然收到错误。
由于我仍然遇到拒绝访问错误,我给了用户完全控制我的机器上的文件夹。应用程序加载。所以...这是一个权限错误。问题是,哪个帐户需要权限?
.Net-Framework和EF的当前版本是什么? – saber
.Net框架是4.0。 EF是4.4.0.0 – jason
您是否尝试安装EF 5? – saber