[C#]这个ConfigurationException异常解决了

其实DLL调用.exe.config中的custom configSetting是没有问题的,是我自己的spell问题,造成命名空间和XML节点名不一致。纠正之后,一切Okay了。

如果配置文件中的

    type="ActionServlet.ActionConfigurationSectionHandler,ActionServlet"/>

所指出的type的最前面的namespace写错了,那么就会导致下面的错误:

DLL里面执行

return (ActionNode[])ConfigurationSettings.GetConfig("ActiveServlet");

时,会直接发生这样的异常:

Exception Information
*********************************************
Exception Type:
System.Configuration.ConfigurationException
Message: Could not create ActiveServlet.ActionConfigurationSectionHandler,ActiionServlet;

StackTrace Information
*********************************************
   at System.Configuration.ConfigurationRecord.GetFactory
(String configKey)
   at System.Configuration.ConfigurationRecord.Evaluate
(String configKey)
   at
System.Configuration.ConfigurationRecord.ResolveConfig
(String configKey)
   at System.Configuration.ConfigurationRecord.GetConfig
(String configKey)
   at
System.Configuration.ConfigurationRecord.ResolveConfig
(String configKey)
   at System.Configuration.ConfigurationRecord.GetConfig
(String configKey)
   at
System.Configuration.DefaultConfigurationSystem.System.Con
figuration.IConfigurationSystem.GetConfig(String
configKey)
   at System.Configuration.ConfigurationSettings.GetConfig
(String sectionName)

实际上有人遇到和我类似的错误:

http://www.google.com/groups?hl=zh-CN&lr=&ie=UTF-8&selm=080501c2c2f3%24d96ff5f0%24d6f82ecf%40TK2MSFTNGXA13

但是Mark指出他可以通过“using a config file which was named & located correctly”来纠正错误,那我呢,就因为这个拼写?



Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=59265


你可能感兴趣的:(configuration)