parkerlouis
05-23-2005, 02:04 AM
Hello,
I am looking at using the Spring.Objects.Factory.Config.PropertyPlaceholderC onfigurer to be fined through a couple custom 'config sections' using name-value properties. Sounds easy enough... I have banged my head off the keyboard a few times and I am now turning to the support forum for some help...
The exception is being thrown when loading the System.Configuration.NameValueSectionHandler.
I have seen a couple forums with this exception and their work around is using Strong type naming for the System.Configuration.NameValueSectionHandler, System.Web, ... but there must be a easier way.
Thanks for your help,
[TypeLoadException]: Could not load type System.Configuration.NameValueSectionHandler from assembly System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.
Web.Config
<configuration>
<configSections>
<sectionGroup name="spring">
<section name="context" type="Spring.Context.Support.ContextHandler, Spring.Core" />
<section name="objects" type="Spring.Context.Support.DefaultSectionHandler, Spring.Core" />
</sectionGroup>
<section name="email-configuration" type="System.Configuration.NameValueSectionHandler"/>
<section name="chat-configuration" type="System.Configuration.NameValueSectionHandler"/>
<section name="database-configuration" type="System.Configuration.NameValueSectionHandler"/>
</configSections>
<database-configuration>
<add key="toolkit.connection.string" value="*********"/>
</database-configuration>
<email-configuration>
<add key="smtp.connection.string" value="*********"/>
</email-configuration>
<chat-configuration>
<add key="chat.url.string" value="*********"/>
</chat-configuration>
<spring>
<context type="Toolkit.Web.Spring.ApplicationContext, Toolkit.Web">
<resource uri="assembly://Toolkit.Services/Toolkit.Services/ServicesConfig.xml" />
<resource uri="config://spring/objects" />
</context>
<objects>
<object name="appConfigPropertyHolder" type="Spring.Objects.Factory.Config.PropertyPlaceholderC onfigurer, Spring.Core">
<property name="configSections">
<list>
<value>database-configuration</value>
<value>email-configuration</value>
<value>chat-configuration</value>
</list>
</property>
</object>
</objects>
</spring>
</configuration>
ServicesConfig.xml
<?xml version="1.0" encoding="utf-8" ?>
<objects xmlns="http://www.springframework.net"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework">
<object name="chatManager" type="Toolkit.Services.Chat.ChatManager, Toolkit.Services" factory-method="CreateInstance">
<property name="ChatMapper">
<ref object="chatMapper" />
</property>
<property name="URL">
<value>${chat.url.string}</value>
</property>
</object>
<object name="SmtpMailManager" type="Toolkit.Services.Common.SmtpMailManager, Toolkit.Services">
<property name="ConnectionString">
<value>${smtp.connection.string}</value>
</property>
</object>
<object name="profileDatabaseConnectionManager" type="Toolkit.DB.ConnectionManager, Toolkit.DB" factory-method="CreateInstance">
<property name="ConnectionString">
<value>${profile.connection.string}</value>
</property>
</object>
</objects>
I am looking at using the Spring.Objects.Factory.Config.PropertyPlaceholderC onfigurer to be fined through a couple custom 'config sections' using name-value properties. Sounds easy enough... I have banged my head off the keyboard a few times and I am now turning to the support forum for some help...
The exception is being thrown when loading the System.Configuration.NameValueSectionHandler.
I have seen a couple forums with this exception and their work around is using Strong type naming for the System.Configuration.NameValueSectionHandler, System.Web, ... but there must be a easier way.
Thanks for your help,
[TypeLoadException]: Could not load type System.Configuration.NameValueSectionHandler from assembly System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.
Web.Config
<configuration>
<configSections>
<sectionGroup name="spring">
<section name="context" type="Spring.Context.Support.ContextHandler, Spring.Core" />
<section name="objects" type="Spring.Context.Support.DefaultSectionHandler, Spring.Core" />
</sectionGroup>
<section name="email-configuration" type="System.Configuration.NameValueSectionHandler"/>
<section name="chat-configuration" type="System.Configuration.NameValueSectionHandler"/>
<section name="database-configuration" type="System.Configuration.NameValueSectionHandler"/>
</configSections>
<database-configuration>
<add key="toolkit.connection.string" value="*********"/>
</database-configuration>
<email-configuration>
<add key="smtp.connection.string" value="*********"/>
</email-configuration>
<chat-configuration>
<add key="chat.url.string" value="*********"/>
</chat-configuration>
<spring>
<context type="Toolkit.Web.Spring.ApplicationContext, Toolkit.Web">
<resource uri="assembly://Toolkit.Services/Toolkit.Services/ServicesConfig.xml" />
<resource uri="config://spring/objects" />
</context>
<objects>
<object name="appConfigPropertyHolder" type="Spring.Objects.Factory.Config.PropertyPlaceholderC onfigurer, Spring.Core">
<property name="configSections">
<list>
<value>database-configuration</value>
<value>email-configuration</value>
<value>chat-configuration</value>
</list>
</property>
</object>
</objects>
</spring>
</configuration>
ServicesConfig.xml
<?xml version="1.0" encoding="utf-8" ?>
<objects xmlns="http://www.springframework.net"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework">
<object name="chatManager" type="Toolkit.Services.Chat.ChatManager, Toolkit.Services" factory-method="CreateInstance">
<property name="ChatMapper">
<ref object="chatMapper" />
</property>
<property name="URL">
<value>${chat.url.string}</value>
</property>
</object>
<object name="SmtpMailManager" type="Toolkit.Services.Common.SmtpMailManager, Toolkit.Services">
<property name="ConnectionString">
<value>${smtp.connection.string}</value>
</property>
</object>
<object name="profileDatabaseConnectionManager" type="Toolkit.DB.ConnectionManager, Toolkit.DB" factory-method="CreateInstance">
<property name="ConnectionString">
<value>${profile.connection.string}</value>
</property>
</object>
</objects>