Quantcast
Channel: Configuration & Scripting
Viewing all articles
Browse latest Browse all 780

Failure to read system.serviceModel using Microsoft.Web.Administration

$
0
0
Hello I'm trying to access sections under system.serviceModel in a web application web.config to edit some WCF service configurations usingMicrosoft.Web.Administration I get the error:
System.IO.FileNotFoundException was unhandled
Message="Filename: \r\nError: The configuration section 'system.serviceModel/services' cannot be read because it is missing schema\r\n\r\n"
Source=""
StackTrace:
at Microsoft.Web.Administration.Interop.IAppHostAdminManager.GetAdminSection(String bstrSectionName, String bstrPath)
at Microsoft.Web.Administration.Configuration.GetSectionInternal(ConfigurationSection section, String sectionPath, String locationPath)
at IISManager.Program.Main(String[] args) in C:\try\IISManager\Program.cs:line 24
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
 this is sample test code that I use: 
ServerManager manager = ServerManager.OpenRemote("machinename");

var site = manager.Sites["SharePoint - 3030"];

var config = site.GetWebConfiguration();

var sectionDef = config.GetEffectiveSectionGroup().SectionGroups["system.serviceModel"].Sections["services"];// this works
Console.WriteLine(sectionDef.Name);

var section = config.GetSection("system.serviceModel/services");//The exception is thrown here
Console.WriteLine(section.SectionPath);

manager.Dispose();
The strange thing is that I can get the section definition (4th line). But I cannot access section data which is required to edit the service configurations, How it it possible to achieve this?

Viewing all articles
Browse latest Browse all 780

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>