参数“sectionGroupName"无效 [英] Parameter 'sectionGroupName' is invalid

查看:93
本文介绍了参数“sectionGroupName"无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试添加服务引用,然后出现此错误.

I am trying to add a service Reference, then I am getting this error.

"参数'sectionGroupName'无效参数名称:sectionGrouName"

"The parameter 'sectionGroupName' is invalid Parameter name: sectionGrouName"

  1. 项目正在运行 .Net 3.5
  2. 当我将项目升级到 .Net 4.0 时,它就可以工作了!但这对我来说不是一个选择,因为其他参考文献使用 3.5
  3. 别人的机器VS运行3.5,可以顺利添加wcf.这意味着它只发生在我的机器上.
  4. 我尝试修复我的 .Net,但错误仍然存​​在.
  5. 检查了我的 web.config 和 machine.config,没有名为 sectionGroupName 的无效参数.
  6. 清理临时文件.同样的错误.

请帮忙.谢谢.

推荐答案

当我调用 'ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None).SectionGroups["sectionGroupName"]' 获取此错误App.config 中的配置.

I got this error when I call 'ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None).SectionGroups["sectionGroupName"]' to get the configuration from App.config.

在 System.Configuration.MgmtConfigurationRecord.GetSectionGroup(String configKey)
   在 TestMonitor.Program.Main(String[] args) 位置 E:\Temp\TestThreads\TestMonitor\Program.cs:行号 15
   在 System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   在 System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   在 System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

我的解决方案只是将 'appSettings' 部分移到 'configSections' 部分之后.也许configSections"必须是配置的第一个子部分.这确实很奇怪!

My resolvent is just move the 'appSettings' section after to the 'configSections' section. Maybe the 'configSections' must be the first child section of configuration. That's queer indeed!

这篇关于参数“sectionGroupName"无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆