2017-01-22 5 views
1

(푸른 Active Directory의 인증을 사용하는) 얻을OwinBuilder.GetAppStartup 오류 "파일 또는 어셈블리를로드 할 수 없습니다"- 어셈블리가 호출 된 위치를 찾는 방법? 나는 기존 Asp.Net 웹 양식 프로젝트에 Microsoft.Owin.Host.SystemWeb을 추가 한

[FileNotFoundException이 : 파일 또는 어셈블리 를로드 할 수 없습니다 'PostSharp .Sdk, 버전 = 2.1.0.0, 문화 = 중립, PublicKeyToken = b13fd38b8f9c99d7 '또는 해당 종속성 중 하나. 지정한 파일을 찾을 수있다.]
System.ModuleHandle.ResolveType을 (RuntimeModule 모듈 INT32 typeToken, 을 IntPtr * typeInstArgs, INT32 typeInstCount, *를 IntPtr methodInstArgs, INT32 methodInstCount, ObjectHandleOnStack 형) +0
System.ModuleHandle .ResolveTypeHandleInternal (RuntimeModule 모듈 INT32 typeToken가 RuntimeTypeHandle [] typeInstantiationContext가 가 RuntimeTypeHandle []를 methodInstantiationContext) 191
System.Reflection.RuntimeModule.ResolveType (INT32 metadataToken이 유형 [] genericTypeArguments은 []를 입력 genericMethodArguments) 162
System.Reflectio n.CustomAttribute.FilterCustomAttributeRecord (CustomAttributeRecord caRecord, MetadataImport 범위, 조립 & lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType이 attributeFilterType, 부울 mustBeInheritable는 [] 속성은 IList의 derivedAttributes, RuntimeType이 & AttributeType에, IRuntimeMethodInfo &의 ctor, 부울 객체 & ctorHasParameters 부울 & isVarArg) 148
System.Reflection.CustomAttribute.GetCustomAttributes (RuntimeModule decoratedModule, decoratedMetadataToken INT32, INT32 pcaCount,,691,363,210 RuntimeType이 attributeFilterType 부울 mustBeInheritable은 IList derivedAttributes 부울 isDecoratedTargetSecurityTransparent) 604 System.Reflection.CustomAttribute.GetCustomAttributes (RuntimeAssembly 조립체 RuntimeType이 caType) 144
Owin.Loader.DefaultLoader.SearchForStartupAttribute (문자열 의 FriendlyName은 IList 1 errors, Boolean& conflict) +189
Owin.Loader.DefaultLoader.GetDefaultConfiguration(String friendlyName, IList
1 오류) +68
Owin.Loader.DefaultLoader.LoadImplementation (문자열 startupName, IList의 1 errorDetails) +89 Owin.Loader.DefaultLoader.Load(String startupName, IList 1 errorDetails) +30
Microsoft.Owin.Host.SystemWeb.OwinBuilder.GetAppStartup() +165
Microsoft.Owin.Host .SystemWeb.OwinHttpModule .InitializeBlueprint() +37 System.Threading.LazyInitializer.EnsureInitializedCore 137
Microsoft.Owin.Host.SystemWeb.OwinHttpModule.Init (같이 HttpApplication (T & 대상 부울은 & &의 SyncLock, Func`1 ValueFactory의 개체 초기화) 컨텍스트) 172
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS ( 을 IntPtr appContext, HttpContext를 컨텍스트 MethodInfo [] 처리기) 618
System.Web.HttpApplication.InitSpecial (HttpApplicationState 상태 MethodInfo [] 처리기를 IntPtr appContext , HttpContext context) +172
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance (IntPtr appContext, HttpContext 컨텍스트) +402
System.Web.Hosting.PipelineRuntime.InitializeApplication (IntPtr입니다 appContext) 343 내가 Owin.Loader.DefaultLoader.SearchForStartupAttribute 반사를 사용하고 일부 속성을로드하지 못했습니다 이해하지만, 그것이 스캔이 어디에 위치하고있는 속성을보고하지 않기 때문에

.

우리 프로젝트는 캐싱 및 로깅을 위해 PostSharp를 사용하지만, 우리가 알고있는 한 version = "4.3.21"을 사용하고 하나의 속성은 "3.0.26.9"를 참조하지만 어쨌든 4.3.21로 리디렉션해야합니다. 로 인해

<bindingRedirect oldVersion="0.0.0.0-4.3.21.0" newVersion="4.3.21.0" /> 

나는 "PostSharp.Sdk"소스 코드를 검색했지만 참조를 찾지 못했습니다.

JetBrain을 사용한 디스 어셈블리의 빠른 모양 DotPeek도 PostSharp.Sdk에 대한 참조를 표시하지 않았습니다. 버전 = 2.1은 매우 오래되었습니다.

비슷한 모양의 링크 http://support.sharpcrafters.com/discussions/problems/2275-postsharp-is-not-compatible-with-microsoftowinsecurity-latest-versionissue with PostSharp cannot find assembly for system.web.mvc, version=3.0.0.0 when no projects reference it이 있지만 반대 문제가 있습니다. PostSharp가 MVC 또는 Owin dll을 확인할 수 없습니다.

누구든지 어떤 속성 (및 어떤 클래스)이 PostSharp.Sdk를 참조하는지 식별 할 수 있습니까?

SearchForStartupAttribute는 사용자 지정 특성에 대해 어셈블리를 검색하고 발견 된 모든 항목을 기록합니다. 더 나은/더 간단한 아이디어가 있습니까?

+0

ex.InnerException에 행운이 있습니까? – Zen

답변

1

오픈 소스 덕분에 소스 코드가 https://katanaproject.codeplex.com/SourceControl/latest#src/Owin.Loader/DefaultLoader.cs 이며 (DefaultLoader에서 사용하는 두 개의 내부 클래스와 함께) 클래스를 로컬로 복사했습니다. 현재 코드는 CustomAttributeFormatException을 무시, 내가 추적을했습니다 그리고 내가 Global.asax에 공개 글로벌()에서 클래스라는 한

private Tuple<Type, string> SearchForStartupAttribute(string friendlyName, IList<string> errors, ref bool conflict) 
foreach (var assembly in _referencedAssemblies) 
      { 
       object[] attributes; 
       try 
       { 
        attributes = assembly.GetCustomAttributes(inherit: false); 
       } 
      // catch (CustomAttributeFormatException) 
      // { 
      //  continue; 
      // } 
       catch (Exception exc) 
       { 
        string message = "In " + assembly.ToString(); 
        System.Diagnostics.Trace.WriteLine(message + " " + exc.ToString()); 
        continue; 
       } 

모든 오류를 무시는

var loader = new Owin.Loader.Debug.DefaultLoader(); 
    IList<string> errorDetauls = new List<string>(); 
    loader.Load("Startup", errorDetauls); 

이 발생 DLL하는 나에게 보여 주었다 문제, 그리고 내가 참조를 제거했습니다. DLL은 이전에 사용되지 않은 PostSharp 라이브러리를 참조했지만 지금까지는 아무런 해를 끼치 지 않았습니다.

SearchForStartupAttribute는 bin 폴더에 있고 깨지기 쉬운 참조 DLL 같은 문제가있는 모든 DLL을 검사합니다. 제안 사항을 제출했습니다. "DefaultLoader.SearchForStartupAttribute should be tolerant to unrelated errors"

+0

원인에 대한 설명 주셔서 감사합니다. –