はspring.net recurseサブディレクトリ?
-
06-09-2019 - |
質問
場合にspring.net 枠組みを開始めるasp.net アプリケーションは、コンポーネントを登録すべてのオブジェクトは、IoCのコンテナrecurseすべてのサブディレクトリを参照している。config?
例えば.
<spring>
<context>
<resource uri="~/bin/ClientService/ClientService.config"/>
<resource uri="~/MCFModule.config"/>
</context>
</spring>
その答えする有のデバッグ情報(パターンリスナー)を出力します。
問題を見かける場合を次のように作成しようとしますインスタンスは'\bin\clientservice'ディレクトリに失敗した場合にはエラーメッセージのものdllに存在するディレクトリのサブディレクトリ;
'がないというファイルまたは組み立て'log4net、バージョン=1.2.10.0文=neutral,PublicKeyToken=1b44e1d426115821'またはその依存関係.システムにファイルを指定します。'
他に当たっては、そのアイデア?
乾杯
Ollie
解決
また、使用して、プログラム的組立負荷障害を処理するためのオプションを持っています
AppDomain.AssemblyResolve
するのAppDomainクラスのイベント。
あなたは、たとえば、あなたが気にアセンブリを探しているすべてのサブディレクトリをスキャンすることができます。
他のヒント
時Spring.NET う解決の参考に設定ファイルでの ルール しています。純組み立てをロードします。うまみを加え、正しい基準のlog4net組み立ておbinフォルダにまとめた。
編集:したい場合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");