2012-04-25 13 views
0

私はSpring.net 1.3.2でASP.Net 4ウェブサイトをセットアップしようとしています。Spring.netでASPXページをロードするときにNullReferenceExceptionが発生するのはなぜですか?

基本ページの場合、Springは問題なくページをロードし、依存関係を問題なく挿入します。私は、次の情報で、CTORとPage_Loadの間とNullReferenceExceptionを取得しかし、いくつかのページで :

メッセージ:

Value cannot be null. 
Parameter name: methodInfoDeclaration 

スタックトレース:1つのページに

at System.Reflection.Emit.TypeBuilder.DefineMethodOverrideNoLock(MethodInfo methodInfoBody, MethodInfo methodInfoDeclaration) 
    at System.Reflection.Emit.TypeBuilder.DefineMethodOverride(MethodInfo methodInfoBody, MethodInfo methodInfoDeclaration) 
    at Spring.Proxy.AbstractProxyMethodBuilder.BuildProxyMethod(MethodInfo method, MethodInfo interfaceMethod) in c:\_prj\spring-net\trunk\src\Spring\Spring.Core\Proxy\AbstractProxyMethodBuilder.cs:line 107 
    at Spring.Web.Support.SupportsWebDependencyInjectionTypeBuilder.BuildProxyType() 
    at Spring.Web.Support.InterceptControlCollectionStrategy.GetInterceptedCollectionType(Type controlCollectionType, InjectDependenciesCallbackHandler staticCallback) 
    at Spring.Web.Support.InterceptControlCollectionStrategy.GetInterceptedCollectionFactory(Type ownerType, Type collectionType) 
    at Spring.Web.Support.InterceptControlCollectionStrategy.InterceptCollection(Control owner, ControlCollection originalCollection) 
    at Spring.Web.Support.InterceptControlCollectionStrategy.Intercept(IApplicationContext defaultApplicationContext, ControlAccessor ctlAccessor, ControlCollectionAccessor ctlColAccessor) 

私はそれを狭めSiteMapDataSourceの問題には、一度コメントを付けると例外が表示されなくなります。ただし、例外は他のページに表示されます。 http://forum.springframework.net/showthread.php?6621-Spring.NET-ASP.NET-4.0-Error

関連するバグがしかし、バージョン1.3.1で修正されています:

は私が他の場所で同様のエラーが発生している人を見つけました。ここで

は私のWeb.configファイルの関連する部分です:

<sectionGroup name="spring"> 
    <section name="context" type="Spring.Context.Support.WebContextHandler, Spring.Web"/> 
</sectionGroup> 

[...] 

<httpHandlers> 
    <add verb="*" path="*.aspx" type="Spring.Web.Support.PageHandlerFactory, Spring.Web" /> 
</httpHandlers> 

<httpModules> 
    <add name="Spring" type="Spring.Context.Support.WebSupportModule, Spring.Web"/> 
</httpModules> 

そして、私のオブジェクト定義:

<object type="Default.aspx"> 
    <property name="TestProperty" value="Spring injected" /> 
</object> 

誰かがこの例外を回避する方法を教えてもらえますか?

答えて

1

2つのSpringアセンブリのバージョンが一致しませんでした。私の同僚の一人がSpring.CoreをNuGetで参照していましたが、Spring.Webを手動でダウンロードした配布で参照しました。

同じソースから両方のアセンブリを参照すると、問題が解決しました。

関連する問題