これはweb.configファイルに関するものです
これがConfigSectionです
<configSections>
<sectionGroup name="HttpExceptionHandler">
<section name="errorLog" type="System.Configuration.SingleTagSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<section name="errorMail" type="System.Configuration.SingleTagSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</sectionGroup>
セクション グループは次のとおりです。
<HttpExceptionHandler>
<errorLog type="MI.Generic.HttpExceptionHandler.SqlErrorLog, MI.Generic.HttpExceptionHandler" dataSource="opentraderdev\dev" initialCatalog="MiTraderError" />
</HttpExceptionHandler>
コードは次のとおりです。
public class ErrorLogConfiguration : ConfigurationSection
{
public static ErrorLogConfiguration GetConfig()
{
return ConfigurationManager.GetSection("HttpExceptionHandler\\errorLog") as ErrorLogConfiguration;
}
[ConfigurationProperty("initialCatalog", IsRequired = true)]
public string InitialCatalog
{
get
{
return this["initialCatalog"] as string;
}
}
[ConfigurationProperty("dataSource", IsRequired = true)]
public string DataSource
{
get
{
return this["dataSource"] as string;
}
}
}
戻り値は常に null です。アイデアが尽きた。どんな助けでも感謝します。