映射文件中定义时缺了“lazy="false”时引发的一个错误

 

“/HotelMIS”应用程序中的服务器错误。

未能加载文件或程序集“Spring.Data, Version=1.2.0.20313, Culture=neutral, PublicKeyToken=65e474d141e25e07”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040)

说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。

异常详细信息: System.IO.FileLoadException: 未能加载文件或程序集“Spring.Data, Version=1.2.0.20313, Culture=neutral, PublicKeyToken=65e474d141e25e07”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040)

源错误:

执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。

程序集加载跟踪: 下列信息有助于确定程序集“Spring.Data, Version=1.2.0.20313, Culture=neutral, PublicKeyToken=65e474d141e25e07”无法加载的原因。

=== 预绑定状态信息 ===
日志: 用户 = CAPITAL/liyougui
日志: DisplayName = Spring.Data, Version=1.2.0.20313, Culture=neutral, PublicKeyToken=65e474d141e25e07
 (Fully-specified)
日志: Appbase = file:///D:/HotelMIS2.0/HotelMIS/
日志: 初始 PrivatePath = D:/HotelMIS2.0/HotelMIS/bin
调用程序集: DBLayer, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null。
===
日志: 此绑定从 default 加载上下文开始。
日志: 正在使用应用程序配置文件: D:/HotelMIS2.0/HotelMIS/web.config
日志: 使用 c:/WINNT/Microsoft.NET/Framework/v2.0.50727/config/machine.config 的计算机配置文件。
日志: 策略后引用: Spring.Data, Version=1.2.0.20313, Culture=neutral, PublicKeyToken=65e474d141e25e07
日志: 试图下载新的 URL file:///c:/WINNT/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/hotelmis/b5165a1d/60e862d9/Spring.Data.DLL。
日志: 试图下载新的 URL file:///c:/WINNT/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/hotelmis/b5165a1d/60e862d9/Spring.Data/Spring.Data.DLL。
日志: 试图下载新的 URL file:///D:/HotelMIS2.0/HotelMIS/bin/Spring.Data.DLL。
警告: 比较程序集名称时发生不匹配: 修订号
错误: 未能完成程序集的安装(hr = 0x80131040)。探测终止。

堆栈跟踪:

[FileLoadException: 未能加载文件或程序集“Spring.Data, Version=1.2.0.20313, Culture=neutral, PublicKeyToken=65e474d141e25e07”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040)]
   System.Reflection.Assembly._GetType(String name, Boolean throwOnError, Boolean ignoreCase) +0
   System.Reflection.Assembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase) +41
   Spring.Core.TypeResolution.TypeResolver.LoadTypeDirectlyFromAssembly(TypeAssemblyHolder typeInfo) +133
   Spring.Core.TypeResolution.TypeResolver.Resolve(String typeName) +179

[TypeLoadException: Could not load type from string value 'DBLayer.BASE.SQLProvider, DBLayer'.]
   Spring.Core.TypeResolution.TypeResolver.Resolve(String typeName) +250
   Spring.Core.TypeResolution.GenericTypeResolver.Resolve(String typeName) +481
   Spring.Core.TypeResolution.CachedTypeResolver.Resolve(String typeName) +340
   Spring.Core.TypeResolution.TypeResolutionUtils.ResolveType(String typeName) +92
   Spring.Objects.Factory.Support.AbstractObjectDefinition.ResolveObjectType() +94
   Spring.Objects.Factory.Support.AbstractObjectFactory.ResolveObjectType(RootObjectDefinition rod, String objectName) +115

[CannotLoadObjectTypeException: Cannot resolve type [DBLayer.BASE.SQLProvider, DBLayer] for object with name 'DbProvider' defined in file [D:/HotelMIS2.0/HotelMIS/BaseConfig.xml]]
   Spring.Objects.Factory.Support.AbstractObjectFactory.ResolveObjectType(RootObjectDefinition rod, String objectName) +199
   Spring.Objects.Factory.Support.DefaultListableObjectFactory.PreInstantiateSingletons() +400
   Spring.Context.Support.AbstractApplicationContext.Refresh() +722
   Spring.Context.Support.WebApplicationContext..ctor(String name, Boolean caseSensitive, IApplicationContext parentContext, String[] configurationLocations) +96
   Spring.Context.Support.WebApplicationContext..ctor(String name, Boolean caseSensitive, String[] configurationLocations) +55

[TargetInvocationException: 调用的目标发生了异常。]
   System.RuntimeMethodHandle._InvokeConstructor(Object[] args, SignatureStruct& signature, IntPtr declaringType) +0
   System.RuntimeMethodHandle.InvokeConstructor(Object[] args, SignatureStruct signature, RuntimeTypeHandle declaringType) +13
   System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +366
   System.Reflection.ConstructorInfo.Invoke(Object[] parameters) +14
   Spring.Util.ObjectUtils.InstantiateType(ConstructorInfo constructor, Object[] arguments) +641

[FatalReflectionException: Cannot instantiate Type [Spring.Context.Support.WebApplicationContext] using ctor [Void .ctor(System.String, Boolean, System.String[])] : '调用的目标发生了异常。']
   Spring.Util.ObjectUtils.InstantiateType(ConstructorInfo constructor, Object[] arguments) +836
   Spring.Context.Support.RootContextInstantiator.InvokeContextConstructor(ConstructorInfo ctor) +198
   Spring.Context.Support.ContextInstantiator.InstantiateContext() +190
   Spring.Context.Support.ContextHandler.InstantiateContext(IApplicationContext parentContext, Object configContext, String contextName, Type contextType, Boolean caseSensitive, String[] resources) +191
   Spring.Context.Support.WebContextHandler.InstantiateContext(IApplicationContext parent, Object configContext, String contextName, Type contextType, Boolean caseSensitive, String[] resources) +369
   Spring.Context.Support.ContextHandler.Create(Object parent, Object configContext, XmlNode section) +513

[ConfigurationErrorsException: Error creating context '/hotelmis': 未能加载文件或程序集“Spring.Data, Version=1.2.0.20313, Culture=neutral, PublicKeyToken=65e474d141e25e07”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040)]
   System.Configuration.BaseConfigurationRecord.EvaluateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult) +358
   System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject) +1455
   System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject) +1451
   System.Configuration.BaseConfigurationRecord.GetSection(String configKey, Boolean getLkg, Boolean checkPermission) +67
   System.Configuration.BaseConfigurationRecord.GetSection(String configKey) +34
   System.Web.HttpContext.GetSection(String sectionName) +62
   System.Web.Configuration.HttpConfigurationSystem.GetSection(String sectionName) +46
   System.Web.Configuration.HttpConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String configKey) +29
   System.Configuration.ConfigurationManager.GetSection(String sectionName) +59
   Spring.Util.ConfigurationUtils.GetSection(String sectionName) +96
   Spring.Context.Support.WebApplicationContext.GetContextInternal(String virtualPath) +1081
   Spring.Context.Support.WebApplicationContext.GetRootContext() +132
   Spring.Context.Support.WebSupportModule.Init(HttpApplication app) +493
   System.Web.HttpApplication.InitModulesCommon() +95
   System.Web.HttpApplication.InitModules() +72
   System.Web.HttpApplication.InitInternal(HttpContext context, HttpApplicationState state, MethodInfo[] handlers) +706
   System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext context) +301
   System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context) +131
   System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +353

 


版本信息: Microsoft .NET Framework 版本:2.0.50727.1433; ASP.NET 版本:2.0.50727.1433

 

出现这个问题的原因是找到了, 就是在映射文件中定义时缺了“lazy="false”,例如

<class name="DBLayer.HR.Customer,DBLayer" table="Customers" lazy="false">

而我原先一直理解为只有在父子关系中父类的映射文件中对子类的定义时才使用“lazy="false">或lazy="ture">

 

 

Spring.NET+NHibernate就是感觉出错很不好查找问题。就像上面的问题, 初学者应该很难找到这个出错一原因是定义时缺了“lazy="false”,

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值