【发布时间】:2014-12-09 08:12:14
【问题描述】:
我在我的 Windows 服务项目中使用 Newtonsoft.Json。
我的Newtonsoft.Json 版本是6.0.0.0,我在我的项目参考中引用了它。
安装和编译顺利进行。但是当我从Services 开始我的服务时,它会抛出一个异常:
无法加载文件或程序集'Newtonsoft.Json,版本=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' 或其之一 依赖关系。系统找不到指定的文件。
我还搜索了网络并在我的app.config 文件中添加了以下内容:
<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>
但仍然出现同样的错误。
我做错了什么?
【问题讨论】:
-
这里可能对您有所帮助:weblog.west-wind.com/posts/2014/Nov/29/…
-
@DavidBrabant 我试过了,但没有帮助。
-
您使用 Newtonsoft.Json 的目的是什么?
-
@firefalcon 我想将我的数组转换为 json 并通过 Web 请求发送。
标签: c# json windows-services json.net