2017-01-22 1 views
1

(AzureのActive Directoryの認証を使用するように)とgetOwinBuilder.GetAppStartupエラー "ファイルまたはアセンブリを読み込めませんでした" - アセンブリが呼び出された場所を見つける方法?私は既存のAsp.Net WebフォームプロジェクトにMicrosoft.Owin.Host.SystemWebを追加しました

[にFileNotFoundException:ファイルまたはアセンブリ をロードできませんでした「PostSharp .Sdk、Version = 2.1.0.0、Culture = neutral、 PublicKeyToken = b13fd38b8f9c99d7 'またはその依存関係の1つ。 システムは、指定されたファイルを見つけることができません。]
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、のInt32 decoratedMetadataToken、のInt32 pcaCount、 RuntimeType attributeFilterType、ブールmustBeInheritable、IListの derivedAttributes、ブールisDecoratedTargetSecurityTransparent)604 System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly アセンブリ、RuntimeType caType)144
Owin.Loader.DefaultLoader.SearchForStartupAttribute(文字列 フレンドリーネーム、の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(T &ターゲット、 ブール&を初期化、& syncLock、Func`1 ValueFactoryのオブジェクト)137
Microsoft.Owin.Host.SystemWeb.OwinHttpModule.Init(のHttpApplication コンテキスト)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"を参照していますが、私は "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

原因を説明してくれてありがとう。 –

関連する問題