2017-09-12 3 views
-2

私たちが所有するいくつかの共通/共有ライブラリアセンブリへの参照を含むwebapi2アプリケーションがあります。これらの共有ライブラリは異なるリポジトリを持ち、ビルドプロセス中にnugetパッケージとして公開されます。最近、webapi2アプリケーションのnugetパッケージリファレンスを、これらの共通パッケージの最新バージョンに更新しました。アセンブリの新しいバージョンであるMicrosoft.Icm.Common.Webには、WebApiExceptionHandlerAttributeという属性がありません。したがって、webapi2アプリケーションをビルドする際には、webapi2コントローラクラスでその属性への参照をすべて削除しました。トラブルシューティングの助けが必要.NETのwebapi2アプリケーションの起動時にTypeLoadExceptionが発生する

メッセージ:アセンブリ 'Microsoft.Icm.Commonから' Microsoft.Icm.Common.Web.WebApiExceptionHandlerAttribute '型を読み込めませんでした。アプリケーションを再構築してステージング環境の1つにデプロイすると、 .Web、Version = 2.4.0.0、Culture =ニュートラル、PublicKeyToken = null '。

のStackTrace:System.ModuleHandle.ResolveTypeHandleInternalでSystem.ModuleHandle.ResolveType(RuntimeModuleモジュールのInt32 typeToken、のIntPtr * typeInstArgs、のInt32 typeInstCount、のIntPtr * methodInstArgs、のInt32 methodInstCount、ObjectHandleOnStack型) (RuntimeModuleモジュールのInt32 typeTokenにおいて、 RuntimeTypeHandle [] typeInstantiationContext、System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord、MetadataImportスコープ、組み立て時RuntimeTypeHandle System.Reflection.RuntimeModule.ResolveTypeで[] methodInstantiationContext) (のInt32 metadataToken、[] genericTypeArgumentsを入力し、[] genericMethodArguments型) & lastAptcaOkAssembly、RuntimeModule decoratedModule、MetadataToken decoratedToken、RuntimeType attributeFilter型、ブールmustBeInheritableは、System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule、のInt32 decoratedMetadataToken、のInt32 pcaCount、RuntimeType attributeFilterTypeで[]属性のIListのderivedAttributes、RuntimeType &とattributeType、IRuntimeMethodInfo & CTOR、ブール& ctorHasParameters、ブール& isVarArg) オブジェクト、System.Web.Http.Controllers.HttpControllerDescriptor.InvokeAttributesOnControllerTypeブールmustBeInheritable、System.Reflection.CustomAttribute.GetCustomAttributesでのIList derivedAttributes、ブールisDecoratedTargetSecurityTransparent) (RuntimeType型、RuntimeType caType、ブール継承) (HttpControllerDescriptor controllerDescriptor、タイプtype) System.Web.Http.Controllers.HttpContrでSystem.Web.Http.DispatcherでollerDescriptor..ctor System.Lazy 1.CreateValue() at System.Lazy 1.LazyInitValueでSystem.Web.Http.Dispatcher.DefaultHttpControllerSelector.InitializeControllerInfoCacheで(HttpConfiguration構成、ストリングコントローラ名、タイプcontrollerType) () () 。 DefaultHttpControllerSelector.GetControllerMapping()System.Web.Http.Routing.AttributeRoutingMapper.AddRouteEntries(SubRouteCollectionコレクタ、HttpConfiguration構成、IInlineConstraintResolver constraintResolver、IDirectRouteProvider directRouteProvider)System.Web.Http.Routing.AttributeRoutingMapperで で。 <> c__DisplayClass2。 <> c__DisplayClass4.b__1() 、System.Web.Http.Routing.RouteCollectionRoute.EnsureInitialized(Func`1 initializer) at System.Web.Http.Routing.AttributeRoutingMapper。 <> c__DisplayClass2.b__0(HttpConfiguration config) at System.Web.OData.Routing.Conventions.AttributeRoutingConvention。 <> c__DisplayClass1。 < .ctor> b__0(HttpConfiguration config) at System.Web.OData.Routing.Conventions.AttributeRoutingConvention。 <> c__DisplayClass1。 < .ctor> b__0(HttpConfiguration config) at System.Web.OData.Routing.Conventions.AttributeRoutingConvention。 <> c__DisplayClass1。 < .ctor> b__0(HttpConfiguration config) at System.Web。OData.Routing.Conventions.AttributeRoutingConvention。 <> c__DisplayClass1。 < .ctor> b__0(HttpConfiguration config) at System.Web.OData.Routing.Conventions.AttributeRoutingConvention。 <> c__DisplayClass1。 < .ctor> b__0(HttpConfiguration config) at System.Web.OData.Routing.Conventions.AttributeRoutingConvention。 <> c__DisplayClass1。 < .ctor> b__0(HttpConfiguration config) at System.Web.OData.Routing.Conventions.AttributeRoutingConvention。 <> c__DisplayClass1。 < .ctor> b__0(HttpConfiguration config) at System.Web.OData.Routing.Conventions.AttributeRoutingConvention。 <> c__DisplayClass1。 < .ctor> b__0(HttpConfiguration config) at System.Web.OData.Routing.Conventions.AttributeRoutingConvention。 <> c__DisplayClass1。 < .ctor> b__0(HttpConfiguration config) at System.Web.OData.Routing.Conventions.AttributeRoutingConvention。 <> c__DisplayClass1。 < .ctor> b__0(HttpConfiguration config) at System.Web.OData.Routing.Conventions.AttributeRoutingConvention。 <> c__DisplayClass1。 < .ctor> b__0(HttpConfiguration config) at System.Web.OData.Routing.Conventions.AttributeRoutingConvention。 <> c__DisplayClass1。 < .ctor> b__0(HttpConfiguration config) at System.Web.OData.Routing.Conventions.AttributeRoutingConvention。 <> c__DisplayClass1。 < .ctor> b__0(HttpConfiguration config) at System.Web.OData.Routing.Conventions.AttributeRoutingConvention。 <> c__DisplayClass1。 < .ctor> b__0(HttpConfiguration config) at System.Web.OData.Routing.Conventions.AttributeRoutingConvention。 <> c__DisplayClass1。 < .ctor> b__0(HttpConfiguration config) at System.Web.OData.Routing.Conventions.AttributeRoutingConvention。 <> c__DisplayClass1。 < .ctor> b__0(HttpConfiguration config) at System.Web.OData.Routing.Conventions.AttributeRoutingConvention。 <> c__DisplayClass1。 < .ctor> b__0(HttpConfiguration config) at System.Web.OData.Routing.Conventions.AttributeRoutingConvention。 <> c__DisplayClass1。 < .ctor> b__0(HttpConfiguration config) at System.Web.OData.Routing.Conventions.AttributeRoutingConvention。 <> c__DisplayClass1。 < .ctor> b__0(HttpConfiguration config) at System.Web.OData.Routing.Conventions.AttributeRoutingConvention。 <> c__DisplayClass1。 < .ctor> b__0(HttpConfiguration config) at System.Web.OData.Routing.Conventions.AttributeRoutingConvention。 <> c__DisplayClass1。 < .ctor> b__0(HttpConfiguration config) at System.Web.OData.Routing.Conventions.AttributeRoutingConvention。 <> c__DisplayClass1。 < .ctor> b__0(HttpConfiguration config) at System.Web.OData.Routing.Conventions.AttributeRoutingConvention。 <> c__DisplayClass1。 < .ctor> b__0(HttpConfiguration config) at System.Web.OData.Routing.Conventions.AttributeRoutingConvention。 <> c__DisplayClass1。 < .ctor> b__0(HttpConfiguration config) at System.Web.OData.Routing.Conventions.AttributeRoutingConvention。 <> c__DisplayClass1。 < .ctor> b__0(HttpConfiguration config) at System.Web.OData.Routing.Conventions.AttributeRoutingConvention。 <> c__DisplayClass1。 < .ctor> b__0(HttpConfiguration config) at System.Web.OData.Routing.Conventions.AttributeRoutingConvention。 <> c__DisplayClass1。 < .ctor> b__0(HttpConfiguration config) at System.Web.OData。Routing.Conventions.AttributeRoutingConvention。 <> c__DisplayClass1。 < .ctor> b__0(HttpConfiguration config) at System.Web.OData.Routing.Conventions.AttributeRoutingConvention。 <> c__DisplayClass1。 < .ctor> b__0(HttpConfiguration config) at System.Web.OData.Routing.Conventions.AttributeRoutingConvention。 <> c__DisplayClass1。 < .ctor> b__0(HttpConfiguration config) at System.Web.OData.Routing.Conventions.AttributeRoutingConvention。 <> c__DisplayClass1。 < .ctor> b__0(HttpConfiguration config) at System.Web.OData.Routing.Conventions.AttributeRoutingConvention。 <> c__DisplayClass1。 < .ctor> b__0(HttpConfiguration config) at System.Web.OData.Routing.Conventions.AttributeRoutingConvention。 <> c__DisplayClass1。 < .ctor> b__0(HttpConfiguration config) at System.Web.OData.Routing.Conventions.AttributeRoutingConvention。 <> c__DisplayClass1。 < .ctor> b__0(HttpConfiguration config) at System.Web.OData.Routing.Conventions.AttributeRoutingConvention。 <> c__DisplayClass1。 < .ctor> b__0(HttpConfiguration config) at System.Web.OData.Routing.Conventions.AttributeRoutingConvention。 <> c__DisplayClass1。 < .ctor> b__0(HttpConfiguration config) at System.Web.OData.Routing.Conventions.AttributeRoutingConvention。 <> c__DisplayClass1。 < .ctor> b__0(HttpConfiguration config) at System.Web.OData.Routing.Conventions.AttributeRoutingConvention。 <> c__DisplayClass1。 < .ctor> b__0(HttpConfiguration config) at System.Web.OData.Routing.Conventions.AttributeRoutingConvention。 <> c__DisplayClass1。 < .ctor> b__0(HttpConfiguration config) at System.Web.OData.Routing.Conventions.AttributeRoutingConvention。 <> c__DisplayClass1。 < .ctor> b__0(HttpConfiguration config) at System.Web.OData.Routing.Conventions.AttributeRoutingConvention。 <> c__DisplayClass1。 < .ctor> b__0(HttpConfiguration config) Microsoft.AzureAd.Icm.IcmV3OData.Global.Initialize()内のE:\ bt \ 787852 \ repo \ src \ OData \ ICMV3OData \ Global.asax.cs:行66 at E:¥bt¥787852¥repo¥src¥OData¥ICMV3OData¥App_Start¥PreLoadInitializationClient.cs内のMicrosoft.AzureAd.Icm.IcmV3OData.PreLoadInitializationClient.Preload(String [] parameters):System.Web.Hosting.PreloadHostの行40 System.Web.Hosting.ProcessHost.PreloadApplicationIfRequired(文字列のAppID、IApplicationHost appHostParameter、HostingEnvironmentParametersで.CreateIProcessHostPreloadClientInstanceAndCallPreload(文字列preloadObjTypeName、文字列[] paramsForStartupObj)System.Web.Hosting.PreloadHost.CreateIProcessHostPreloadClientInstanceAndCallPreloadで (文字列preloadObjTypeName、文字列[] paramsForStartupObj) hostingParameters、LockableAppDomainConte xt ac) 'と表示されます。ワーカープロセスは正常でないとマークされ、シャットダウンされます。データフィールドにはエラーコードが含まれています。

最近作成されたwebapi2アプリケーションでは、使用できないWebApiExceptionHandlerAttribute(新しいMicrosoft.Icm.Common.Webアセンブリ)への参照がなくても、アプリケーションの実行時に何らかの理由で使用できない属性が使用されています。私はResharperのdotnetpeekのようなツールを使い、binplacedアセンブリの中で "WebApiExceptionHandlerAttribute"という用語を探しました。その属性のマッチは表示されません。だから、どうやってWebアプリケーションがアプリケーションの起動時にそのタイプを見つけようとしているのか理解できますか?

答えて

0

この問題の根本原因を特定しました。私はwebapi2アプリケーション用のbinフォルダ内に別の古いアセンブリがあったようですが、これはほぼ3ヶ月間廃止され、アプリケーションのビルド時にもはや生成されませんでした。その古いアセンブリは、現在無効な属性への参照を持っていました。 iis webapi2アプリケーションフォルダから古くなったアセンブリを削除すると、うまく動作するようになりました。

関連する問題