Unable to load config file

Topics: Validation Application Block
Jul 19, 2007 at 5:58 PM
I have a WCF service hosted in IIS. In code, I use this when a CreateGrocery() service method is called:

string s1 = @"C:\Documents and Settings\jones\My Documents\Visual Studio 2005\Projects\GroceryStore.Client\GroceryStore.Services.Contracts\GroceryStore.Services.dll.config";

FileConfigurationSource fcs = new FileConfigurationSource(s1);
Validator<GroceryStore.Services.Contracts.GroceryStoreData> customerValidator = ValidationFactory.CreateValidatorFromConfiguration<GroceryStore.Services.Contracts.GroceryStoreData>("Rule Set A", fcs);
ValidationResults results = customerValidator.Validate(data);

if (!results.IsValid)
{
// ...
}

At runtime, the service complains that it cannot find the file pointed to by variable s1. I paste the path from variable s1 into the run command, and voila, the file loads just fine. I've given the ASP.NET account access to all the folders related to my project.

Is this a known bug? Do we know if the validation block is able to load externally stored config files successfully or do I have some other problem? I encounter the same problem when I place this section in the web.config file:

<configSections>
<section name="enterpriseLibrary.ConfigurationSource" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceSection, Microsoft.Practices.EnterpriseLibrary.Common, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</configSections>

<enterpriseLibrary.ConfigurationSource selectedSource="File Configuration Source">
<sources>
<add name="File Configuration Source"
type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
filePath="C:\Documents and Settings\jones\My Documents\Visual Studio 2005\Projects\GroceryStore.Client\GroceryStore.Services.Contracts\GroceryStore.Services.dll.config" />
</sources>
</enterpriseLibrary.ConfigurationSource>

Thanks in advance!