自托管owin Web API的MEF组件 [英] MEF component for self hosted owin web api
问题描述
我正在尝试创建一个MEF组件,该组件将在Windows服务中使用并将运行自托管的Web api.
I'm trying to create a MEF component that will be used in a windows service and will run a selfhosted web api.
当我使用Newtonsoft.Json作为委托消息处理程序并且当前使用v8.0.3时,加载库的依赖项时遇到问题.但是,System.Net.Http.Formatting.dll文件需要版本6.0.0.0,这是我的MEF组件 无法加载.
I'm having a problem loading the dependencies of the library as I use Newtonsoft.Json for a delegated message handler and currently use v8.0.3. However, the System.Net.Http.Formatting.dll file requires version 6.0.0.0 and this is were my MEF component fails to load.
我有一个app.config文件,它确实在bin目录中创建了正确的.config文件,并且我已将其复制到插件所在的扩展目录中,并且它具有我认为是正确的重定向条目:
I have an app.config file that does create the proper .config file in the bin directory and I have copied to the extensions directory where the plugin resides and it has what I think is the proper redirect entry:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
但是,这似乎无法解决问题,并且我不断遇到相同的错误. 有什么我想念的吗?
However this does not seem to solve the issue and I keep getting the same error. Is there something I missing?
谢谢
推荐答案
FernandoCBI,
Hi FernandoCBI,
谢谢您在这里发布.
对于您的问题,它是Newtonsoft.Json需要6.0的版本吗?
For your question, is it the version of Newtonsoft.Json require 6.0?
您可以单击工具">"NuGet程序包管理器">管理解决方案的NuGet程序包".然后选择所需的版本.
You could click Tools>NuGet Package Manager>Manage NuGet Packages for Solution. And choose the version you want.
我希望这会有所帮助.
If you have some about the web API, you could post a new thread in Web API.
最佳书呆子,
温迪
这篇关于自托管owin Web API的MEF组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!