7

私は、もともと ASP.Net MVC 4 Beta および EF 4.3.1 でシングル ページ アプリケーションに取り組んでいます。MVC 4 および EF 5 のすべての NuGet パッケージを更新しました。これで、ApiController または DbDataController を呼び出すたびに、次の例外が発生します。

アセンブリ 'System.Web.Http、バージョン = 4.0.0.0、カルチャ = ニュートラル、PublicKeyToken = 31bf3856ad364e35' から型 'System.Web.Http.Controllers.HttpControllerConfigurationAttribute' を読み込めませんでした。

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 は削除されましたが、とにかく明示的に使用していたわけではありません。

コントローラー構成ごと: ASP.NET Web API コントローラーは、独自のフォーマッター、アクション セレクター、およびパラメーター バインダーをセットアップするために IControllerConfiguration を実装するカスタム属性で属性を付けることができます。HttpControllerConfigurationAttribute が削除されました。 MVC 4 リリース ノート

私の質問は、この時点でこのタイプをロードしようとしている可能性があるのは何ですか?

編集:これは、MVC 4 ベータ以降、SPA ビットが更新されておらず、そこにコントローラー構成属性があるためだと考えています。

4

2 に答える 2

1

コントローラー構成ごと: ASP.NET Web API コントローラーは、独自のフォーマッター、アクション セレクター、およびパラメーター バインダーをセットアップするために IControllerConfiguration を実装するカスタム属性で属性を付けることができます。HttpControllerConfigurationAttribute が削除されました。MVC 4 リリース ノート

于 2012-08-27T21:52:37.400 に答える
0

GAC に古いバージョンの System.Web.Http がある可能性があります。dll を GAC したベータ版を信じているため、この問題が発生しています...この古い dll を GAC 解除しても、この問題は発生しません。

于 2012-08-28T21:12:06.457 に答える