ConfigurationErrorsException:此元素当前不与任何上下文关联上下文、不与、元素、ConfigurationErrorsException

2023-09-04 00:40:34 作者:ら抑宁

我正奇怪的例外,这在我看来是与WCF配置对象,但什么是错误完全是我不清楚

I am getting strange exception which seems to me is related to WCF configuration object but what is wrong is completely unclear to me

有一个第一次机会异常的类型'System.Configuration.ConfigurationErrorsException的System.Configuration.dll发生

A first chance exception of type 'System.Configuration.ConfigurationErrorsException' occurred in System.Configuration.dll

附加信息:该元素当前不与任何上下文相关联

Additional information: This element is not currently associated with any context

ServiceModelSectionGroup serviceConfigs =
ServiceModelSectionGroup.GetSectionGroup(config);

ServiceElement serviceConfig = 
serviceConfigs.Services.Services[serviceType.ToString()]; << here exception

推荐答案

看起来像其他很多人刚刚通过禁用打破此异常解决了这个问题 - 请参见here, here, 这里和here,例如。似乎没有人有什么用这种例外的是,虽然任何想法。

Looks like a lot of other people have solved this problem just by disabling breaking on this exception - see here, here, here and here, for example. Nobody seems to have any idea what use this exception is, though.

我要补充一点,我不得不手动添加例外,我调试/例外列表 - 它并没有默认显示

I should add that I had to add the exception manually to my Debug/Exceptions list - it didn't appear by default.