Generally, only the Application can use the custom IConfigurationSectionHandler interface class to read the configuration in app. config.
Only two steps are required:
Step 1: Define a class in your application:
Public class ActionConfigurationSectionHandler: IConfigurationSectionHandler, and
Overload public object Create (object parent,
??? Object configContext,
??? System. Xml. XmlNode section) method.
Then, in app. config, like log4net:
??
??? Type = "log4net. Config. Log4NetConfigurationSectionHandler, log4net"/>
?
Note: enter the name and namespace of your class in the type attribute.
However, in general, only the exe and Web pages can use these default configuration files. For a custom DLL, you can only write a class for processing configuration files to specify which configuration file to use.
Otherwise, the DLL will reuse the configuration file of the EXE that calls it.
ConfigurationSettings. GetConfig ("ActionServlet/ActionsMap ")
The configuration file someapp.exe. config of the exeis located on the attachment.
?
I have a dlland actionconfigurationsectionhandlerclass, and define it in someapp.exe. config.
???? Type = "ActiveServlet. ActionConfigurationSectionHandler, ActiveServlet"/>
Hope to use ConfigurationSettings. GetConfig ("ActionsMap ")
?
Trackback: http://tb.blog.csdn.net/TrackBack.aspx? PostId = 58895