Could not load ConfigurationSection class - type
at web.config
<section name="FlowWebDataProviders" type="FlowWebProvidersSection" requirePermission="false"/>
<FlowWebDataProviders peopleProviderName="sqlProvider" IzmListProviderName="sqlProvider">
<PeopleProviders>
<add name="sqlProvider" type="SqlPeopleProvider" connectionStringName="FlowServerConnectionString"/>
<add name="xmlProvider" type="XmlPeopleProvider" schemaFile="People.xsd" dataFile="People.xml"/>
</PeopleProviders>
<IzmListProviders>
<add name="sqlProvider" type="SqlIzmListProvider" connectionStringName="FlowServerConnectionString"/>
</IzmListProviders>
</FlowWebDataProviders>
and
public class FlowWebProvidersSection :开发者_开发问答 ConfigurationSection
{
[ConfigurationProperty("peopleProviderName", IsRequired = true)]
public PeopleProviderName : string
{
get { this["peopleProviderName"] :> string }
set { this["peopleProviderName"] = value; }
}
[ConfigurationProperty("IzmListProviderName", IsRequired = true)]
public IzmListProviderName : string
{
get { (this["IzmListProviderName"] :> string) }
set { this["IzmListProviderName"] = value; }
}
[ConfigurationProperty("PeopleProviders")]
[ConfigurationValidatorAttribute(typeof(ProviderSettingsValidation))]
public PeopleProviders : ProviderSettingsCollection
{
get { this["PeopleProviders"] :> ProviderSettingsCollection }
}
[ConfigurationProperty("IzmListProviders")]
[ConfigurationValidatorAttribute(typeof(ProviderSettingsValidation))]
public IzmListProviders : ProviderSettingsCollection
{
get { this["IzmListProviders"] :> ProviderSettingsCollection }
}
}
and
public class ProviderSettingsValidation : ConfigurationValidatorBase
{
public override CanValidate(typex : Type) : bool
{
if(typex : object == typeof(ProviderSettingsCollection)) true else false
}
/// <summary>
// validate the provider section
/// </summary>
public override Validate(value : object) : void
{
mutable providerCollection : ProviderSettingsCollection = match(value)
{
| x is ProviderSettingsCollection => x
| _ => null
}
unless (providerCollection == null)
{
foreach (_provider is ProviderSettings in providerCollection)
{
when (String.IsNullOrEmpty(_provider.Type))
{
throw ConfigurationErrorsException("Type was not defined in the provider");
}
mutable dataAccessType : Type = Type.GetType(_provider.Type);
when (dataAccessType == null)
{
throw (InvalidOperationException("Provider's Type could not be found"));
}
}
}
}
}
project : Web Application ...
I need to find error first . . .
why :
Error message parser: Error creating configuration section handler for FlowWebDataProviders: Could not load type 'FlowWebProvidersSection'.
?
by the way : syntax of nemerle (current language) is very similar C#, don't afraid to read the code... thank you
added : this is how I want to get section
ConfigurationManager.GetSection("FlowWebDataProviders")
Check your type AND namespace. I.e.
<section name="hibernate-configuration" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" />
精彩评论