2017-06-05 20 views
0

このセクションと同じ実行可能アセンブリ(IVITerminal.exe)でカスタム構成セクションクラスを定義しました。実行可能ファイルで定義されたカスタム構成セクション

<configSections> 
.... 
<section name="myconfig" type="IVITermital.Configuration.Section, IVITerminal"/> 
.... 
</configSections> 
.... 
<myconfig>....</myconfig> 

をしかし、私はセクション読みたいとき:App.configファイルでは、私は持っている

static void Main(string[] args) 
{ 
    var s = ConfigurationManager.GetSection("myconfig") as Section; 

を私はタイプSystem.Configuration.ConfigurationErrorsExceptionの例外Could not load type 'IVITermital.Configuration.Section' from assembly 'IVITerminal'.を得ました。

同じexeで設定セクションを定義することはできますか?

答えて

1

このエラーは、通常、ファイルに何らかの種類の構文エラーがあったことを意味します。私。配置が間違っていたり、スペルが間違っていたり、閉じられていないセクションでした。

内部例外はありましたか?ここ

<configuration> 
    <!-- Configuration section-handler declaration area. --> 
     <configSections> 
    <sectionGroup name="pageAppearanceGroup"> 
     <section 
     name="pageAppearance" 
     type="Samples.AspNet.PageAppearanceSection" 
     allowLocation="true" 
     allowDefinition="Everywhere" 
     /> 
    </sectionGroup> 
     <!-- Other <section> and <sectionGroup> elements. --> 
    </configSections> 

    <!-- Configuration section settings area. --> 

</configuration> 

より:

MSDNのドキュメントには、このようなフォーマットを説明しhttps://msdn.microsoft.com/en-us/library/2tw134k3.aspx

+0

それは、クラス名のタイプミスだったありがとう – shibormot

関連する問題