configSections

  • Thread starter Thread starter MCM
  • Start date Start date
M

MCM

I have the following configSections in my web.config. Again, it's not clear
to me what this is doing because I can delete the entire section and the
application compiles and runs fine. Why do I need this?

<configSections>
<sectionGroup name="system.web.extensions"
type="System.Web.Configuration.SystemWebExtensionsSectionGroup,
System.Web.Extensions, Version=3.5.0.0, Culture=neutral,
PublicKeyToken=31BF3856AD364E35">
<sectionGroup name="scripting"
type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions,
Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="scriptResourceHandler"
type="System.Web.Configuration.ScriptingScriptResourceHandlerSection,
System.Web.Extensions, Version=3.5.0.0, Culture=neutral,
PublicKeyToken=31BF3856AD364E35" requirePermission="false"
allowDefinition="MachineToApplication" />
<sectionGroup name="webServices"
type="System.Web.Configuration.ScriptingWebServicesSectionGroup,
System.Web.Extensions, Version=3.5.0.0, Culture=neutral,
PublicKeyToken=31BF3856AD364E35">
<section name="jsonSerialization"
type="System.Web.Configuration.ScriptingJsonSerializationSection,
System.Web.Extensions, Version=3.5.0.0, Culture=neutral,
PublicKeyToken=31BF3856AD364E35" requirePermission="false"
allowDefinition="Everywhere" />
<section name="profileService"
type="System.Web.Configuration.ScriptingProfileServiceSection,
System.Web.Extensions, Version=3.5.0.0, Culture=neutral,
PublicKeyToken=31BF3856AD364E35" requirePermission="false"
allowDefinition="MachineToApplication" />
<section name="authenticationService"
type="System.Web.Configuration.ScriptingAuthenticationServiceSection,
System.Web.Extensions, Version=3.5.0.0, Culture=neutral,
PublicKeyToken=31BF3856AD364E35" requirePermission="false"
allowDefinition="MachineToApplication" />
<section name="roleService"
type="System.Web.Configuration.ScriptingRoleServiceSection,
System.Web.Extensions, Version=3.5.0.0, Culture=neutral,
PublicKeyToken=31BF3856AD364E35" requirePermission="false"
allowDefinition="MachineToApplication" />
</sectionGroup>
</sectionGroup>
</sectionGroup>
</configSections>
 
Hello MCM,

Thanks for using Microsoft Newsgroup Support Service, my name is Ji Zhou
[MSFT] and I will be working on this issue with you.

Based on my understanding, what we concern about now is the purpose of
configSections element in our Web.config file. If I have misunderstood,
please let me know. These declarations in the configSections element enable
us to configure ASP.NET applications that can be used by AJAX-enabled
clients, Windows Communication Foundation (WCF) clients (SOAP clients), and
.NET Framework clients.

* Enabling ASP.NET application services through the authenticationService,
roleService, and profileService elements.
* Configuring the script handler through the enableCompression and
enableCaching attributes of the scriptResourceHandler element.
* Configuring JSON serialization through the jsonSerialization element.

See this document: http://msdn.microsoft.com/en-us/library/bb546044.aspx.
We can delete them, if we do not configure about these features.

To know more general information about the ASP.NET configuration file,
please refer this document
http://msdn.microsoft.com/en-us/library/ms228256.aspx.

If you have any future questions about this, please feel free to let me
know.

Best regards,
Ji Zhou ([email protected], remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/default.aspx?target=assistance&ln=en-us.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
I'm sorry, but this is still not very clear to me. What do configSections do?
It sounds like they tell the compiler to look for other sections within
web.config - is that correct? But if that is true, then why don't I need
configSections for all my other web.config elements?

"Ji Zhou [MSFT]" said:
Hello MCM,

Thanks for using Microsoft Newsgroup Support Service, my name is Ji Zhou
[MSFT] and I will be working on this issue with you.

Based on my understanding, what we concern about now is the purpose of
configSections element in our Web.config file. If I have misunderstood,
please let me know. These declarations in the configSections element enable
us to configure ASP.NET applications that can be used by AJAX-enabled
clients, Windows Communication Foundation (WCF) clients (SOAP clients), and
.NET Framework clients.

* Enabling ASP.NET application services through the authenticationService,
roleService, and profileService elements.
* Configuring the script handler through the enableCompression and
enableCaching attributes of the scriptResourceHandler element.
* Configuring JSON serialization through the jsonSerialization element.

See this document: http://msdn.microsoft.com/en-us/library/bb546044.aspx.
We can delete them, if we do not configure about these features.

To know more general information about the ASP.NET configuration file,
please refer this document
http://msdn.microsoft.com/en-us/library/ms228256.aspx.

If you have any future questions about this, please feel free to let me
know.

Best regards,
Ji Zhou ([email protected], remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/default.aspx?target=assistance&ln=en-us.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hello MCM,

Yes, you are right about purpose of configSections. Let me do some future
clarifications.

From the MSDN document
http://msdn.microsoft.com/en-us/library/ms228256.aspx , we know that the
configSections element is required because ASP.NET makes no presumptions
about how to handle settings within a configuration file. Instead, ASP.NET
delegates the processing of configuration data to configuration section
handlers.

To understand about the above description better, let us do the following
test:

1.Firstly, we create an empty web application, and open the Web.config file
in Visual Studio. We will see the configSections you post above.

2.We type "<test></test>" right behind the configSections element, and
press F5 to debug the application. We will receive an error says
"Unrecognized configuration section test."

3.We replace the text "<test></test>" with the text
"<system.web.extensions></system.web.extensions>", and then I press F5 to
debug. Everything works fine.

The reason is that if we want to use a kind of element, we firstly need to
declare it in the configSections element. ("test" is not declared, while
"system.web.extensions" is, in the configSections in the above experiment).

As to your question: why we can use the <system.web> as well as other
elements without declaring them in the configSections? The reason is we
have a machine.config file which defines the default elements for us. We
can find this file in this location:
C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG\. You can use the
notepad to view its content.

To know more about how to use <system.web.extensions> configuration, please
refer this link:
http://www.asp.net/AJAX/documentation/live/ConfiguringASPNETAJAX.aspx


Best regards,
Ji Zhou ([email protected], remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top