每次我這個自定義欄目做了ConfigurationManager.GetSection("registeredPlugIns")
我收到此錯誤:自定義的ConfigurationSection類型不正確加載
出錯創建registeredPlugIns配置節處理程序:
Could not load type 'Engine.PlugInArch.PlugInConfigurationSection' from assembly 'System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
爲什麼嘗試從System.Configuration
加載類型而不是我要求的程序集?
這是我第代碼:
namespace Engine.PlugInArch
{
public class PlugInConfigurationSection : ConfigurationSection
{
[ConfigurationProperty("plugIns", IsDefaultCollection = false),
ConfigurationCollection(typeof(PlugInCollection), AddItemName = "addPlugin")]
public PlugInCollection PlugIns
{
get { return this["plugIns"] as PlugInCollection; }
}
}
}
,這裏是我的app.config
<configuration>
<configSections>
<section name="registeredPlugIns" type="Engine.PlugInArch.PlugInConfigurationSection, Engine"/>
</configSections>
...
<registeredPlugIns>
<plugIns>
<addPlugIn DllName="ProcessorPlugin.dll"/>
</plugIns>
</registeredPlugIns>
</configuration>
它實際上是Engine.exe會這麼重要嗎?它們的類型位於引用此app.config的程序集中。 – 2010-11-24 16:36:01