无法加载文件或程序集'EntityFramework'的一个或多个依赖项。该程序集可能已被篡改。

3

我正在尝试通过Visual Studio 2012将我的Webforms项目发布到我的主机1&1。我的Web项目在本地运行良好,没有任何问题。它能够成功构建和发布,但是当我输入域名网址时,出现以下错误。

Could not load file or assembly 'EntityFramework' or one of its dependencies. Strong name signature could not be verified.  The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)



WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value
[HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value    
[HKLM\Software\Microsoft\Fusion!EnableLog].



[FileLoadException: Could not load file or assembly 'EntityFramework' or one of its dependencies. Strong name signature could not be verified.  The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)]

[FileLoadException: Could not load file or assembly 'EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. Strong name signature could not be verified.  The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)]
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) +34
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) +16
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=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. Strong name signature could not be verified.  The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)]
 System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +752
 System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +218
 System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +130
 System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +170
 System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +91
 System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath) +258
 System.Web.Compilation.BuildManager.ExecutePreAppStart() +135
 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +516

[HttpException (0x80004005): Could not load file or assembly 'EntityFramework,      Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. Strong name signature could not be verified.  The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)]
 System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9874840
 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254

请您给予建议,我已经搜索了很久也没有结果!- 我正在努力解决这个问题并且不知道该如何查找。

2个回答

1
在我的情况下,entityframework.dll文件的数字签名未被识别。
我通过卸载和重新安装NUGET实体框架包来解决问题,重新发布项目,一切正常。(如果您不使用nuget,可以删除引用并重新添加)

1

看起来你的主机1&1没有安装.Net 4.5。如果你想使用EF 5.0.0.0,你需要这个版本的.Net。


谢谢你的回复。它支持4-4.5,我已经检查过了。我不确定这个问题的原因是什么。 - KyleK
请确保在您发布的 \bin 目录中有 EntityFramework 程序集。 - dgarbacz

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接