Loading System.ServiceModel configuration section using ConfigurationManager

前端 未结 5 1596
借酒劲吻你
借酒劲吻你 2020-12-07 18:30

Using C# .NET 3.5 and WCF, I\'m trying to write out some of the WCF configuration in a client application (the name of the server the client is connecting to).

The o

5条回答
  •  爱一瞬间的悲伤
    2020-12-07 19:05

    GetSectionGroup() does not support no parameters (under framework 3.5).

    Instead use:

    Configuration config = System.Configuration.ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
    ServiceModelSectionGroup group = System.ServiceModel.Configuration.ServiceModelSectionGroup.GetSectionGroup(config);
    

提交回复
热议问题