Spring.NET 配置错误【Spring.Context.Support.ContextRegistry”的类型初始值设定项引发异常。】

时间:2015-05-20 18:06:26   收藏:0   阅读:1002

用VS 2013 ,配置Spring后,运行时出现如下错误:

Spring.Context.Support.ContextRegistry”的类型初始值设定项引发异常。

 

原因:App.config配置文件,startup放到文件前了。

解决方法:将startup放到最后,问题没有了。

 

<?xml version="1.0" encoding="utf-8"?>
<configuration>

<configSections>
<sectionGroup name="spring">
<!--提供Spring对应用程序上下文的支持-->
<section name="context" type="Spring.Context.Support.ContextHandler,Spring.Core"/>
<!--提供Spring对 对象容器的支持-->
<section name="objects" type="Spring.Context.Support.DefaultSectionHandler,Spring.Core"/>
</sectionGroup>

</configSections>

<spring>
<context>
<!--Spring中 IOC容器 所使用的对象XML文件定义-->
<resource uri="assembly://WindowsFormsApplication1/WindowsFormsApplication1.ObjectConfige/Objects.xml"/>
</context>

</spring>

<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>

评论(0)
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!