更新到Asp.Net MVC 4 RTM后未能加载类型HttpControllerConfigurationAttribute [英] Could not load type HttpControllerConfigurationAttribute after updating to Asp.Net MVC 4 RTM

查看:306
本文介绍了更新到Asp.Net MVC 4 RTM后未能加载类型HttpControllerConfigurationAttribute的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的一个单页的应用最初在ASP.Net MVC 4 Beta版和EF 4.3.1。我更新了所有的Nu​​Get包的MVC 4和EF 5.现在,每当我打个电话给ApiController或DbDataController我得到了以下异常:

I'm working on a Single Page Application originally on ASP.Net MVC 4 Beta and EF 4.3.1. I updated all of the NuGet packages for MVC 4 and EF 5. Now whenever I make a call to an ApiController or DbDataController I get the following exception:

未能加载从装配式'System.Web.Http.Controllers.HttpControllerConfigurationAttribute'System.Web.Http,版本= 4.0.0.0,文化=中性公钥= 31bf3856ad364e35'。

Could not load type 'System.Web.Http.Controllers.HttpControllerConfigurationAttribute' from assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

at System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type)
at System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
at System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeType type, RuntimeType caType, Boolean inherit)
at System.RuntimeType.GetCustomAttributes(Boolean inherit)
at System.Web.Http.Controllers.HttpControllerDescriptor.InvokeAttributesOnControllerType(HttpControllerDescriptor controllerDescriptor, Type type)
at System.Web.Http.Controllers.HttpControllerDescriptor.InvokeAttributesOnControllerType(HttpControllerDescriptor controllerDescriptor, Type type)
at System.Web.Http.Controllers.HttpControllerDescriptor.InvokeAttributesOnControllerType(HttpControllerDescriptor controllerDescriptor, Type type)
at System.Web.Http.Controllers.HttpControllerDescriptor..ctor(HttpConfiguration configuration, String controllerName, Type controllerType)
at System.Web.Http.Dispatcher.DefaultHttpControllerSelector.InitializeControllerInfoCache()
at System.Lazy`1.CreateValue()

按照MVC 4发行说明,HttpControllerConfigurationAttribute已被删除,而不是我用它明确反正。

According to the MVC 4 release notes, HttpControllerConfigurationAttribute has been removed, not that I was using it explicitly anyway.

每控制器配置:ASP.NET的Web API控制器可以实现IControllerConfiguration设置自己的格式化程序,动作选择和参数粘合剂的自定义属性归属。该HttpControllerConfigurationAttribute已被删除。
   MVC 4发行说明

Per controller configuration: ASP.NET Web API controllers can be attributed with a custom attribute that implements IControllerConfiguration to setup their own formatters, action selector and parameter binders. The HttpControllerConfigurationAttribute has been removed. MVC 4 Release Notes

我的问题是什么可以尝试加载该类型在这一点?

My question is what could be trying to load this type at this point?

编辑:我在想,现在,这是因为SPA位没有因为MVC 4 Beta版更新,并有在那里控制器配置属性。

I'm thinking right now that this is because the SPA bits have not been updated since the MVC 4 Beta, and there are controller configuration attributes in there.

推荐答案

每控制器配置:ASP.NET的Web API控制器可以实现IControllerConfiguration设置自己的格式化程序,动作选择和参数粘合剂的自定义属性归属。该HttpControllerConfigurationAttribute已被删除。 MVC 4发行说明

Per controller configuration: ASP.NET Web API controllers can be attributed with a custom attribute that implements IControllerConfiguration to setup their own formatters, action selector and parameter binders. The HttpControllerConfigurationAttribute has been removed. MVC 4 Release Notes

这篇关于更新到Asp.Net MVC 4 RTM后未能加载类型HttpControllerConfigurationAttribute的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆