vb.net 无法加载文件或程序集“DotNetOpenAuth.AspNet”或其依赖项之一
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20009739/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Could not load file or assembly 'DotNetOpenAuth.AspNet' or one of its dependencies
提问by Trotski94
I have an Asp.net project, and in said projects web.config i have
我有一个 Asp.net 项目,在上述项目中,我有 web.config
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="DotNetOpenAuth.AspNet" publicKeyToken="2780ccd10d57b246" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="DotNetOpenAuth.Core" publicKeyToken="2780ccd10d57b246" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
(already followed a should-be-fix from another post)
but on runtime i get
(已经从另一篇文章中遵循了应该修复的问题)
但在运行时我得到
Could not load file or assembly 'DotNetOpenAuth.AspNet' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
When I open up the properties of my project, and go to refrences, i can see that there is a DotNetOpenAuth.Coreentry, a DotNetOpenAuth.AspNetentry, a DotNetOpenAuth.OAuthentry,a DotNetOpenAuth.OAuth.Consumerentry, a DotNetOpenAuth.OpenIdentry, and a DotNetOpenAuth.OpenId.RelyingPartyentry, and theyre all set to Copy Local = true.
What could possibly be going wrong?
当我打开我的项目的属性并转到 refrences 时,我可以看到有一个 DotNetOpenAuth.Core条目、一个DotNetOpenAuth.AspNet条目、一个DotNetOpenAuth.OAuth条目、一个DotNetOpenAuth.OAuth.Consumer条目、一个DotNetOpenAuth.OpenId条目和一个DotNetOpenAuth.OpenId.RelyingParty条目,并且它们都设置为 Copy Local = true。可能出什么问题了?
EDIT:
heres the full error log, looks like its still trying to load 4.3.0.0 to me
编辑:
这是完整的错误日志,看起来它仍在尝试向我加载 4.3.0.0
Assembly Load Trace: The following information can be helpful to determine why the assembly 'DotNetOpenAuth.AspNet' could not be loaded.
=== Pre-bind state information ===
LOG: User = MegaBadTouch\James
LOG: DisplayName = DotNetOpenAuth.AspNet
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: DotNetOpenAuth.AspNet | 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:/Users/James/Documents/Visual Studio 2012/Projects/Archive/Archive/
LOG: Initial PrivatePath = C:\Users\James\Documents\Visual Studio 2012\Projects\Archive\Archive\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\James\Documents\Visual Studio 2012\Projects\Archive\Archive\web.config
LOG: Using host configuration file: C:\Users\James\Documents\IISExpress\config\aspnet.config
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/James/AppData/Local/Temp/Temporary ASP.NET Files/root/47d58003/7c1d4013/DotNetOpenAuth.AspNet.DLL.
LOG: Attempting download of new URL file:///C:/Users/James/AppData/Local/Temp/Temporary ASP.NET Files/root/47d58003/7c1d4013/DotNetOpenAuth.AspNet/DotNetOpenAuth.AspNet.DLL.
LOG: Attempting download of new URL file:///C:/Users/James/Documents/Visual Studio 2012/Projects/Archive/Archive/bin/DotNetOpenAuth.AspNet.DLL.
LOG: Using application configuration file: C:\Users\James\Documents\Visual Studio 2012\Projects\Archive\Archive\web.config
LOG: Using host configuration file: C:\Users\James\Documents\IISExpress\config\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Redirect found in application configuration file: 4.0.0.0 redirected to 4.1.0.0.
LOG: Post-policy reference: DotNetOpenAuth.AspNet, Version=4.1.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246
LOG: Attempting download of new URL file:///C:/Users/James/AppData/Local/Temp/Temporary ASP.NET Files/root/47d58003/7c1d4013/DotNetOpenAuth.AspNet.DLL.
LOG: Attempting download of new URL file:///C:/Users/James/AppData/Local/Temp/Temporary ASP.NET Files/root/47d58003/7c1d4013/DotNetOpenAuth.AspNet/DotNetOpenAuth.AspNet.DLL.
LOG: Attempting download of new URL file:///C:/Users/James/Documents/Visual Studio 2012/Projects/Archive/Archive/bin/DotNetOpenAuth.AspNet.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Minor Version
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
Stack Trace:
[FileLoadException: Could not load file or assembly 'DotNetOpenAuth.AspNet' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
[FileLoadException: Could not load file or assembly 'DotNetOpenAuth.AspNet, Version=4.1.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
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 'DotNetOpenAuth.AspNet, Version=4.1.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
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 'DotNetOpenAuth.AspNet, Version=4.1.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9874840
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254
采纳答案by Jithesh Chandra
I had the same error It was that one of the references that you have added might have got missed . all you need to do is drop the references and add them back manually . or copy your code into a new solution it would work .I copied my code into a " new empty project " and ran it . it had no problems then .
我有同样的错误 这是您添加的参考资料之一可能已被遗漏。您需要做的就是删除引用并手动添加它们。或者将您的代码复制到一个新的解决方案中,它会起作用。我将我的代码复制到一个“新的空项目”中并运行它。那时没有问题。
Open a new empty project with new classes and aspx and copy just your code into it , it should work .
用新的类和 aspx 打开一个新的空项目,然后将您的代码复制到其中,它应该可以工作。
回答by 6dev6il6
I changed the versions to 4.1.0.0 and it worked for me.
我将版本更改为 4.1.0.0,它对我有用。
<dependentAssembly>
<assemblyIdentity name="DotNetOpenAuth.Core" publicKeyToken="2780CCD10D57B246" culture="neutral" />
<bindingRedirect oldVersion="1.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="DotNetOpenAuth.AspNet" publicKeyToken="2780CCD10D57B246" culture="neutral" />
<bindingRedirect oldVersion="1.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
</dependentAssembly>
</assemblyBinding>

