2009-05-26 19 views
0

spring.netフレームワークがasp.netアプリケーションを起動すると、IoCコンテナ内のすべてのオブジェクトを登録するコンポーネントは、web.configで参照されているすべてのサブディレクトリを再帰しますか?spring.netはサブディレクトリを再帰しますか?

例えば、

<spring> 
    <context> 
    <resource uri="~/bin/ClientService/ClientService.config"/> 
    <resource uri="~/MCFModule.config"/> 
    </context> 
</spring> 

私は、デバッグ情報(トレースリスナー)の出力を見て答えがイエスであると信じています。

私が見ている問題は、 '\ bin \ clientservice'ディレクトリにインスタンスを作成しようとすると、dllがサブディレクトリに存在するにもかかわらずエラーメッセージで失敗するということです。

'ファイルまたはアセンブリ' log4net、Version = 1.2.10.0、Culture = neutral、PublicKeyToken = 1b44e1d426115821 'またはその依存関係のいずれかを読み込めませんでした。システムは、指定されたファイルを見つけることができません。 '

いずれかのアイデアはありますか?

乾杯

Ollie第

答えて

2

ます。また を使用して、プログラムで組立負荷障害を処理するためのオプションを持っていますイベントはAppDomainクラスにあります。

たとえば、気になるアセンブリを探しているすべてのサブディレクトリをスキャンできます。

0

Spring.NETはそれは.NETアセンブリローダーと同じrulesを使用する設定ファイル内の参照を解決しようとしています。だから、おそらくあなたのbinフォルダにlog4netアセンブリの正しい参照を追加しようとすることができます。


EDIT:あなたはSpring.NETは、非標準的な場所にアセンブリを見つけたい場合は、場所を示すために、<assemblyBinding>要素を使用することができます。

<?xml version="1.0" encoding="utf-8" ?> 
<configuration> 
    <configSections> 
    <sectionGroup name="spring"> 
     <section name="context" type="Spring.Context.Support.ContextHandler, Spring.Core"/> 
     <section name="objects" type="Spring.Context.Support.DefaultSectionHandler, Spring.Core" /> 
    </sectionGroup> 
    </configSections> 

    <spring> 
    <context> 
     <resource uri="config://spring/objects"/> 
    </context> 
    <objects xmlns="http://www.springframework.net"> 
     <object id="someObject" type="log4net.Util.AppenderAttachedImpl, log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821" /> 
    </objects> 
    </spring> 

    <runtime> 
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> 
     <dependentAssembly> 
     <assemblyIdentity name="log4net" 
          publicKeyToken="1b44e1d426115821" 
          culture="neutral" /> 
     <codeBase version="1.2.10.0 
        href="file:///c:/some_special_location/log4net.dll" /> 
     </dependentAssembly> 
    </assemblyBinding> 
    </runtime> 

</configuration> 

をそして、あなたはインスタンス化するコンテナを求めることができます対象:

var someObject = ContextRegistry.GetContext().GetObject("someObject"); 
+0

これは私の理解でもありますが、log4netは 'bin \ clientservice'ディレクトリにあり、サブディレクトリから解決できません... – AwkwardCoder

関連する問題