2014-04-21 37 views
-2

尽管通读C#config节,上午线得到一个错误的第一节如何读取配置文件从C#代码

The application relative virtual path '~' is not allowed here.

System.Configuration.Configuration config = 
    System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~"); 
SystemWebSectionGroup grp = (SystemWebSectionGroup)config.GetSectionGroup("system.web"); 
+0

你可以显示配置文件中的部分是什么样子 – MethodMan

回答