2012-02-17 25 views
4

私の設定ファイルはベースディレクトリにあり、コンテンツ/コピーは常にasp .net Webプロジェクトに設定されています。アプリケーションが実行されると、ファイル。asp.netアプリケーションの設定ソースファイルが見つかりません

<enterpriseLibrary.ConfigurationSource selectedSource="System Configuration Source"> 
<sources> 
    <add name="System Configuration Source" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.SystemConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.414.0, Culture=neutral, PublicKeyToken=null" /> 
    <!--<add name="Logging File Source" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.414.0, Culture=neutral, PublicKeyToken=null" 
    filePath="AutomatorConsoleFileFullLogging.config" />--> 
    <add name="Logging File Source" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.414.0, Culture=neutral, PublicKeyToken=null" 
    filePath="Logging Configs\AutomatorConsoleFileFullLogging.config" /> 
    <add name="Exception Handling Source" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.414.0, Culture=neutral, PublicKeyToken=null" 
filePath="ExceptionHandling.config" /> 
    <add name="Policy Injection Configuration Source" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.414.0, Culture=neutral, PublicKeyToken=null" 
    filePath="PolicyInjection.config" /> 
</sources> 
<redirectSections> 
    <add sourceName="Exception Handling Source" name="exceptionHandling" /> 
    <add sourceName="Logging File Source" name="loggingConfiguration" /> 
    <add sourceName="Policy Injection Configuration Source" name="Policy Injection Settings" /> 
</redirectSections> 

+0

ファイルが実際に予想される場所にあることを確認しましたか? – NotMe

答えて

2

次のようなメッセージが表示されることが想定されています。System.IO.FileNotFoundException:構成ファイルcache.configが見つかりませんでした。

構成から、Enterprise Library 5.0(Build 414)を使用していることがわかります。そのリリースには相対パスでissueがあり、ASP.NETにはFileConfigurationSourceがあります。

Microsoft Enterprise Library 5.0 Optional Update 1(ビルド505)この問題は修正されていますので、最新バージョンを使用すると問題は解決されます。

また、絶対パスを使用するように設定ファイルを変更することもできます。別の修正は、パスを正しく解決する独自のFileConfigurationSourceを作成することです。ソースはcomments of the issue reportにあります。

0
<!--<add name="Logging File Source" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.414.0, Culture=neutral, PublicKeyToken=null" 
    filePath="AutomatorConsoleFileFullLogging.config" />--> 
    <add name="Logging File Source" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.414.0, Culture=neutral, PublicKeyToken=null" 
    filePath="Logging Configs\AutomatorConsoleFileFullLogging.config" /> 

なぜ?

最初のタグのコメントを解除し、2番目のタグをコメントにします。私はあなたの問題を解決すべきだと思いますか?

+1

サブディレクトリにあるので –

+0

@Kayode Leonard:私の謝罪。あなたの投稿では、 "私は基本ディレクトリに自分の設定ファイルを持っていて、Content/copy alwaysに設定する"と言っています。 'AutomatorConsoleFileFullLogging.config'が' Logging Conifigs'ディレクトリにどのようにするのかは明らかではありませんでした。それで、私の反応。 – user347805

関連する問題