3
votes

I would like to add this section to my machine.config in exactly the same way many articles and microsoft are suggesting:

  <configuration>
    <system.net>
       <connectionManagement>
         <add name = "www.contoso.com" maxconnection = "4" />
         <add name = "*" maxconnection = "2" />
       </connectionManagement>
     </system.net>
 </configuration>

http://msdn.microsoft.com/en-us/library/aa903351(v=vs.71).aspx http://geekswithblogs.net/StuartBrierley/archive/2009/09/30/tuning-iis---machine.config-settings.aspx

As soon as I do it though, I get this exception when trying to hit a page hosted on the IIS on the same machine:

Parser Error Message: Unrecognized configuration section system.net.

Source Error:

Line 9:      settings that differ from their defaults.
Line 10: --><configuration>
Line 11:  <system.net>
Line 12:          <connectionManagement>
Line 13:              <add address="*" maxconnection="24" />

Source File: C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\Config\machine.config

Line: 11

Where is the problem and how can I modify the machine.config so that I can finally control the maxconnection value?

4
You should mark an answer has accepted even if it's yours.João Angelo

4 Answers

2
votes

In my machine.config line 10 is still part of the opening comments. Did you delete those?

the --> suggests you may not have deleted the closing xml comment, or you may have accidentally deleted the opening xml comment token. Make sure you have the opening <!--

EDIT:

Do you have the opening xml header? the fact the line numbers are off seems odd to me. Line 9 should be one line higher up. Here's what it should look like:

<?xml version="1.0" encoding="UTF-8"?>
<!--
    Please refer to machine.config.comments for a description and
    the default values of each configuration section.

    For a full documentation of the schema please refer to
    http://go.microsoft.com/fwlink/?LinkId=42127

    To improve performance, machine.config should contain only those
    settings that differ from their defaults.
-->
1
votes

The resolution was to move the config section after this line in the config file:

  <sectionGroup name="system.net" type="System.Net.Configuration.NetSectionGroup, ...

That seem to help tha matters.

0
votes

If you're adding the XML in your question to the config file as-is, that's a problem.

configuration should be the (single) root element, you should add system.net under that if it doesn't exist - under configuration.

If it does exist, add the connectionManagement section in the existing system.net section.

If that already exists, add or modifify the existing add tags.

0
votes

Verify that you're not adding the system.net section before the configSections element.

The configSections element if present in the configuration file must the first child of configuration and in machine.config you should have configSections element defined.


Disclaimer: I answered the question without realizing that it was already asked eight months ago and that the OP had already found a solution to the problem. Since his answer gives a solution without explaining why, I decided not to delete my answer, and now I have a disclaimer that's bigger than the answer... I should really start to pay more attention.