asp.net配置读取子节错误

lek*_*kso 2 asp.net config

在配置文件中,我有一个带有一些值的电子邮件部分,自定义配置管理器读得很好.现在我需要在Email部分添加一个子部分,以下行给出错误:

var configInstance =(ProgConfiguration)System.Configuration.ConfigurationManager.GetSection("Prog");

错误消息是:"配置属性'EmailAccounts'可能不是从ConfigurationSection派生的."

<Prog Debug="true">
<Email 
FromEmail="me@me.com" 
EmailSubject="Your content" 
MailServerList="mymail_com">
<EmailAccounts
StandardEmail="one@me.com"
SupportEmail="two@me.com"/>
</Email>
</Prog>
Run Code Online (Sandbox Code Playgroud)

有什么帮助吗?

dre*_*dre 7

将EmailAccounts更改为ConfigurationElement而不是ConfigurationSection