web.config problems

O

Ohad Young

Hi,

I have problems in configuring a web.config file of an ASP.NET Web Service
project.
I declared a new settings section group named metaServer which contains a
nested
section group named availableServers that contains two sections,
DeGeLServers and
spockServers. Following is the XML snippet for it:

<configuration>
<configSections>
<sectionGroup name="metaServer">
<sectionGroup name="availableServers">
<section name="DeGeLServers"
type="System.Configuration.NameValueSectionHandler, System" />
<section name="spockServers"
type="System.Configuration.NameValueSectionHandler, System" />
</sectionGroup>
</sectionGroup>
</configSections>
<metaServer>
<availableServers>
<DeGeLServers>
<add key="Dev" value="localhost" />
<add key="BGU" value="http://medinfo.bgu.ac.il/DeGeL.NET/" />
</DeGeLServers>
<spockServers>
<add key="Dev" value="localhost" />
<add key="BGU" value="http://medinfo.bgu.ac.il/SpockServer/" />
</spockServers>
</availableServers>
</metaServer>
<system.web>
....
</configuration>

When invoking the webservice that uses the web.config above, the following
exception is thrown:

System.Configuration.ConfigurationException: Exception creating section
handler. (c:\inetpub\wwwroot\DeGeLForSpockServer\web.config line 6) --->
System.IO.FileNotFoundException: File or assembly name System, or one of its
dependencies, was not found.
File name: "System"
at System.Type.GetType(String typeName, Boolean throwOnError)
at System.Web.Configuration.HttpConfigurationRecord.GetFactory(String
configKey)

Please advise.
--
Ohad Young
Medical Informatics Research Center
Ben Gurion University
Information System Eng
Office Phone: 972-8-6477160
Cellular Phone: 972-54-518301
E-Mail: (e-mail address removed)
 
M

MSFT

Hello,

From MSDN, <sectionGroup> can only have <section> as child item. If you
only use one layer section group, for example:

<configuration>
<configSections>

<sectionGroup name="availableServers">
<section name="DeGeLServers"
type="System.Configuration.NameValueSectionHandler, System" />
<section name="spockServers"
type="System.Configuration.NameValueSectionHandler, System" />
</sectionGroup>

</configSections>

<availableServers>
<DeGeLServers>
<add key="Dev" value="localhost" />
<add key="BGU" value="http://medinfo.bgu.ac.il/DeGeL.NET/" />
</DeGeLServers>
<spockServers>
<add key="Dev" value="localhost" />
<add key="BGU" value="http://medinfo.bgu.ac.il/SpockServer/" />
</spockServers>
</availableServers>


will this correct the problem?

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
M

MSFT

Hello,

Any updates? Will it work corectly after you remove one section group?

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
O

Ohad Young

Hi,

Sorry for the late response, I was out of the office (University) for a
while.
I tried what you recommended (removing one of the section group) but it
didn't help.

The inspiration I had to create a nested group was derived from a sample I
found in
the .NET SDK - "Creating New Configuration Sections".
I tried it in a simple console application and it didn't work as well, same
error.

I also found in the MSDN some help on the web.config schema, in the
<sectionGroup>
help the "Remarks" contains the following:
"Declaring a section group creates a container tag for configuration
sections and ensures
that there are no naming conflicts with configuration sections defined by
someone else.
You can nest <sectionGroup> elements within each other."

Can you send me a working example of both a config file with new
<sectionGroup> and a
some code in C# using it?

Please advise, Ohad
 
O

Ohad Young

Hi,

Great news, I overcame the problem and all works fine!!!
I have a nested <sectionGroup> as well.

The problem was in the <section> element in the attribute type.
The version, public key etc. were missing, thus the section handler
could not be loaded. I looked at the machine.config on my computer
and used the same definitions in my project.

It did the magic!!!

Thanks anyway, Ohad
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,280
Latest member
BGBBrock56

Latest Threads

Top