Ane*_*lou 2 c# asp.net asp.net-web-api .net-standard .net-standard-2.0
我有一个针对asp.net 4.7的MVC项目.我创建了一个针对.Net标准2.0的类库
如果我从我的MVC项目引用类库,我在应用程序启动时会遇到以下异常.
System.MissingMethodException:'找不到方法:
消息"未找到方法:'System.Collections.ObjectModel.Collection`1 System.Web.Http.HttpConfiguration.get_MessageHandlers()'."
在
GlobalConfiguration.Configure(WebApiConfig.Register);
Run Code Online (Sandbox Code Playgroud)
如果我删除引用,一切都恢复正常.任何可能有误的想法?
您需要将此绑定重定向添加到web.config:
<dependentAssembly>
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
</dependentAssembly>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
835 次 |
| 最近记录: |