2017-09-12 2 views
-2

우리가 소유하고있는 공용/공유 라이브러리 어셈블리에 대한 참조가있는 webapi2 응용 프로그램이 있습니다. 공유 라이브러리는 저장소가 다르므로 빌드 프로세스 중에 누겟 패키지로 게시됩니다. 최근에 webappi2 애플리케이션의 nuget 패키지 참조를 해당 공통 패키지의 최신 버전으로 업데이트했습니다. 어셈블리 중 하나 인 Microsoft.Icm.Common.Web의 최신 버전에는 더 이상 WebApiExceptionHandlerAttribute 특성이 없습니다. 따라서 webapi2 애플리케이션을 빌드 할 때 webapi2 컨트롤러 클래스에서 해당 속성에 대한 모든 참조를 제거했습니다. 응용 프로그램을 다시 작성하고 스테이징 환경 중 하나를 배포하면 다음과 같은 유형로드 예외가 발생합니다.문제 해결을위한 도움이 필요합니다. .NET webapi2 응용 프로그램 시작시 TypeLoadException이 발생합니다.

메시지 : 어셈블리에서 'Microsoft.Icm.Common.Web.WebApiExceptionHandlerAttribute'를로드 할 수 없습니다. 'Microsoft.Icm.Common .Web, 버전 = 2.4.0.0, 문화 = 중립, PublicKeyToken = null '.

스택 트레이스 : System.ModuleHandle.ResolveTypeHandleInternal에서 System.ModuleHandle.ResolveType (RuntimeModule 모듈 INT32 typeToken, *를 IntPtr typeInstArgs, INT32 typeInstCount, *를 IntPtr methodInstArgs, INT32 methodInstCount, ObjectHandleOnStack 형) (RuntimeModule 모듈 INT32 typeToken에서, RuntimeTypeHandle []는 typeInstantiationContext, RuntimeTypeHandle []는 methodInstantiationContext) System.Reflection.RuntimeModule.ResolveType (INT32 metadataToken에서 , System.Reflection.CustomAttribute.FilterCustomAttributeRecord (CustomAttributeRecord caRecord, MetadataImport 범위, 협의회)]을 genericMethodArguments 를 입력 []를 입력 genericTypeArguments & lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken 데코 레이팅 된 태그, 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, 종류 형) System.Web.Http.Controllers.HttpContr에서 ollerDescriptor..ctor (HttpConfiguration 구성, 문자열 컨트롤러 명, 유형 controllerType) System.Web.Http.Dispatcher에서 System.Lazy 1.CreateValue() at System.Lazy 1.LazyInitValue() 에서 System.Web.Http.Dispatcher.DefaultHttpControllerSelector.InitializeControllerInfoCache에서 () . 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.AttributeRoutingMapper System.Web.Http.Routing.RouteCollectionRoute.EnsureInitialized (Func`1 이니셜)에 . <> 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 구성) 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 : line 66 at E : \ bt \ 787852 \ repo \ src \ OData \ ICMV3OData \ App_Start \ PreLoadInitializationClient.cs의 Microsoft.AzureAd.Icm.IcmV3OData.PreLoadInitializationClient.Preload (String [] 매개 변수) : System.Web.Hosting.PreloadHost의 줄 .CreateIProcessHostPreloadClientInstanceAndCallPreload (문자열 preloadObjTypeName 문자열 [] paramsForStartupObj) System.Web.Hosting.PreloadHost.CreateIProcessHostPreloadClientInstanceAndCallPreload (문자열 preloadObjTypeName 문자열 [] paramsForStartupObj) System.Web.Hosting.ProcessHost.PreloadApplicationIfRequired (문자열 APPID, IApplicationHost appHostParameter에서 , HostingEnvironmentParameters에서 hostingParameters, LockableAppDomainConte xt ac) '. 작업자 프로세스가 비정상으로 표시되고 종료됩니다. 데이터 필드에 오류 코드가 있습니다.

최근에 작성한 webapi2 응용 프로그램이 더 이상 사용할 수없는 WebApiExceptionHandlerAttribute (최신 Microsoft.Icm.Common.Web 어셈블리)에 대한 참조를 가지고 있지 않아도 응용 프로그램을 실행할 때 사용할 수없는 특성이 사용되고있는 것처럼 보입니다. Resharper의 dotnetpeek과 같은 도구를 사용하고 binplaced 어셈블리에서 "WebApiExceptionHandlerAttribute"라는 용어를 찾았으므로 해당 특성에 대한 일치 항목이 표시되지 않습니다. 그렇다면 웹 응용 프로그램이 응용 프로그램 시작시 해당 유형을 찾으려고하는 이유는 무엇인지 어떻게 알 수 있습니까?

답변

0

이 문제점의 근본 원인을 확인했습니다. 거의 3 개월 동안 사용되지 않았으며 응용 프로그램을 만들 때 더 이상 생성되지 않은 webapi2 응용 프로그램의 bin 폴더에 다른 부실 어셈블리가있는 것 같습니다.그 부실한 어셈블리는 지금 없어진 속성에 대한 참조를 가지고 있습니다. iis webapi2 응용 프로그램 폴더에서 부실 어셈블리를 제거한 후에는 정상적으로 작동하기 시작했습니다.

관련 문제