首页 新闻 会员 周边

未能加载文件或程序集“Newtonsoft.Json”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。

0
悬赏园豆:100 [已解决问题] 解决于 2015-08-06 09:18

[FileLoadException: 未能加载文件或程序集“Newtonsoft.Json”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040)]

[FileLoadException: 未能加载文件或程序集“Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 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: 未能加载文件或程序集“Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 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, Boolean& isRefAssemblyLoaded) +285
   System.Web.Compilation.BuildManager.ExecutePreAppStart() +153
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +521

[HttpException (0x80004005): 未能加载文件或程序集“Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040)]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9951956
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254
HandsCool的主页 HandsCool | 初学一级 | 园豆:4
提问于:2015-08-06 09:04
< >
分享
最佳答案
0

利用Nuget重新安装就好了。这个一般是两个库依赖不同版本的Newtonsoft.Json,可以在web.config/app.config中配置,最简单的方式还是直接重新用Nuget安装一下。

收获园豆:70
幻天芒 | 高人七级 |园豆:37175 | 2015-08-06 09:10

赞!!!!!!

HandsCool | 园豆:4 (初学一级) | 2015-08-06 09:17

@HandsCool: :)

幻天芒 | 园豆:37175 (高人七级) | 2015-08-06 09:20

 赞!!说得对

大稳·杨 | 园豆:202 (菜鸟二级) | 2016-08-31 13:39
其他回答(3)
0

1.json.net 在运行目录下是否存在

2.存在的话检查版本

收获园豆:30
吴瑞祥 | 园豆:29449 (高人七级) | 2015-08-06 09:07

谢谢了!

支持(0) 反对(2) HandsCool | 园豆:4 (初学一级) | 2015-08-06 09:17
0

看bin下面又没有这个dll

Cacivy | 园豆:225 (菜鸟二级) | 2015-08-08 12:31
1

  <runtime>

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>

</assemblyBinding>

  </runtime>

share your knowledge with the world! | 园豆:197 (初学一级) | 2015-08-09 12:47

这个是正确答案。

支持(0) 反对(0) Treenew Lyn | 园豆:105 (初学一级) | 2015-08-10 09:27

@Treenew Lyn: 

放置 web.config 或 app.config

支持(0) 反对(2) Treenew Lyn | 园豆:105 (初学一级) | 2015-08-10 09:28
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册