System.Configuration.ConfigurationErrorsException:“Error creating context 'spring.root': 未能找到文件“***”

异常信息:

System.Configuration.ConfigurationErrorsException
  HResult=0x80131902
  Message=Error creating context 'spring.root': 未能找到文件“H:\Code\Project\SpringDemo\Spring.NetDemo\Spring.NetDemo\bin\Debug\service.xml”。
  Source=System.Configuration
  StackTrace:
   在 System.Configuration.BaseConfigurationRecord.EvaluateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult)
   在 System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject)
   在 System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
   在 System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
   在 System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
   在 System.Configuration.BaseConfigurationRecord.GetSection(String configKey)
   在 System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName)
   在 System.Configuration.ConfigurationManager.GetSection(String sectionName)
   在 Spring.Util.ConfigurationUtils.GetSection(String sectionName)
   在 Spring.Context.Support.ContextRegistry.InitializeContextIfNeeded()
   在 Spring.Context.Support.ContextRegistry.GetContext()
   在 Spring.NetDemo.Form1.button1_Click(Object sender, EventArgs e) 在 H:\Code\Project\SpringDemo\Spring.NetDemo\Spring.NetDemo\Form1.cs 中: 第 25 行
   在 System.Windows.Forms.Control.OnClick(EventArgs e)
   在 System.Windows.Forms.Button.OnClick(EventArgs e)
   在 System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   在 System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   在 System.Windows.Forms.Control.WndProc(Message& m)
   在 System.Windows.Forms.ButtonBase.WndProc(Message& m)
   在 System.Windows.Forms.Button.WndProc(Message& m)
   在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   在 System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   在 System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   在 System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   在 System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   在 System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   在 System.Windows.Forms.Application.Run(Form mainForm)
   在 Spring.NetDemo.Program.Main() 在 H:\Code\Project\SpringDemo\Spring.NetDemo\Spring.NetDemo\Program.cs 中: 第 19 行

内部异常 1:
ObjectDefinitionStoreException: IOException parsing XML document from file [H:\Code\Project\SpringDemo\Spring.NetDemo\Spring.NetDemo\bin\Debug\service.xml]

内部异常 2:
FileNotFoundException: 未能找到文件“H:\Code\Project\SpringDemo\Spring.NetDemo\Spring.NetDemo\bin\Debug\service.xml”。
 

 

解决方案:

找到你单独写配置的xml文件,在修改文件属性中的 复制到输出目录:如果较新则复制

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值