spring.net错误排查 Error creating context 'spring.root': InputStream is null from Resource

在学习博主刘冬的内容时,想复现lesson_2的内容,写完后的代码调试总是遇到报:

Error creating context 'spring.root': InputStream is null from Resource = [assembly [Spring_2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null], resource [Spring_2.Objects.xml]]

经一天的思考与排查,我发现这是因为我没把“Objects.xml”的属性设为“生成嵌入的资源”,而是为vs2010预设的“内容”。

解决办法:

选中“Objects.xml”文件,再改变其“生成操作”属性为“生成嵌入的资源”。即可!

阅读更多
换一批

vs2013 Error creating context 'spring.root': 请求在此上下文中不可用

02-25

最近在学习spring.net 就做了一个简单的用例 spring.net+nhibernate4+mvc4 可在初始化spring的时候报错。 一直没找到原因, 在非web程序下是没问题的。还望大神们指点一二。rn[img=http://img.bbs.csdn.net/upload/201502/25/1424874175_92638.png][/img]rn[img=http://img.bbs.csdn.net/upload/201502/25/1424874187_809676.png][/img]rnrn用户代码未处理 System.Configuration.ConfigurationErrorsExceptionrn HResult=-2146232062rn Message=Error creating context 'spring.root': 请求在此上下文中不可用rn Source=System.Configurationrn BareMessage=Error creating context 'spring.root': 请求在此上下文中不可用rn Line=0rn StackTrace:rn 在 System.Configuration.BaseConfigurationRecord.EvaluateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult)rn 在 System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject)rn 在 System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)rn 在 System.Configuration.BaseConfigurationRecord.GetSection(String configKey)rn 在 System.Web.HttpContext.GetSection(String sectionName)rn 在 System.Web.Configuration.HttpConfigurationSystem.GetSection(String sectionName)rn 在 System.Web.Configuration.HttpConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String configKey)rn 在 System.Configuration.ConfigurationManager.GetSection(String sectionName)rn 在 Spring.Util.ConfigurationUtils.GetSection(String sectionName)rn 在 Spring.Context.Support.ContextRegistry.InitializeContextIfNeeded()rn 在 Spring.Context.Support.ContextRegistry.GetContext()rn 在 AQS.WebClient.MvcApplication.Init() 位置 e:\工作资料\DotNet\WebClient\Global.asax.cs:行号 34rn 在 System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers)rn InnerException: System.Web.HttpExceptionrn HResult=-2147467259rn Message=请求在此上下文中不可用rn Source=System.Webrn ErrorCode=-2147467259rn WebEventCode=0rn StackTrace:rn 在 System.Web.HttpContext.get_Request()rn 在 Spring.Util.VirtualEnvironment.HttpRuntimeEnvironment.RewriteContext..ctor(String virtualDirectory, Boolean rebaseClientPath)rn 在 Spring.Util.VirtualEnvironment.HttpRuntimeEnvironment.RewritePath(String virtualDirectory, Boolean rebaseClientPath)rn 在 Spring.Util.VirtualEnvironment.RewritePath(String newVirtualPath, Boolean rebaseClientPath)rn 在 Spring.Util.HttpContextSwitch..ctor(String virtualDirectory)rn 在 Spring.Context.Support.WebContextHandler.InstantiateContext(IApplicationContext parent, Object configContext, String contextName, Type contextType, Boolean caseSensitive, IList`1 resources)rn 在 Spring.Context.Support.ContextHandler.Create(Object parent, Object configContext, XmlNode section)rn InnerException: rn

没有更多推荐了,返回首页