Tried my first web deployment project today after installing latest. What I think is a simple use of it was to replace the system.web section with system.web=release.config.
However the deployment project balks with an error:
Doesn't matter whether UseExternalConfigSource is true or false. As well Release.config has only a system.web section.
My web.config file as found in the deployment directory (copied from web project by the build) certainly has a system.web section and is displayed verbatim below with some of the comments shortened but not removed (in case comments are not being parsed
properly). It seems like Web Deployment 2.0 cannot do basic parsing of a pretty close to standard Ajax web.config file. I cannot see any errors in the web.config below nor does VS report any. Not very useful add-in, if basic functionality is broken. My purpose
was to turn tracing off, but since trace is used in multiple sections, replacing the whole section was the only logical option.
This is added to direct the System.Diagnostics.Trace output to the ASP.NET page
Advantage of using a trace listener is that the output from a custom control and support classes can also be sent to the page without using the HttpContext.
implemented everywhere by adding using Trce = System.Diagnostics.Trace; and Trce.WriteLine("") statements. Works in page or in referenced components
VS 2005 Web Deployment Projectscustomizationweb.configconfigurationweb deployment project msbuild task copy global.asax application_start session_startVisual Studio 2005 Web Deployment Projects
After some experimentation, I found that while you cannot replace system.web section you can replace the connectionStrings section and other sections. This doesn't make a lot of sense hard coding nodes in an XML file that you can and cannot replace, plus
an incredibly misleading error message when you try. The documentation on MSDN does not say anything about which sections you can and cannot replace, and this is probably a developer error in not treating the file like an XML file with a hiearchy of XML nodes.
That should have been a piece of cake with standard XML functions, to remove a node and add a new one.
My suggestion for the syntax for the replacement should be a hierarchry of nodes to replace ANY node like "configuration/system.web/trace=trace.config". This does not work now even though I have seen examples suggesting there is a hiearchy.
The reason you can't replace system.web is that technically it isn't a configuration section: if you look in machine.config, you'll see that it is in fact a sectionGroup:
The reason you can't replace a sectionGroup is that the add-in assembly Microsoft.WebDeployment.Tasks.dll is using the API exposed by System.Configuration.Configuration / System.Configuration.ConfigurationSection etc to do the replacement - and this API
only works with configuration sections.
I agree with you that it would be better to be able to replace any node in the config file: for the purposes of replacement the distinction between a sectionGroup and a section is rather arbitrary. This could be done my modifying Microsoft.WebDeployment.Tasks.dll
to use an XML API (XmlDocument etc) to do the replacement.
I need to custom replace the sessionState property depending on the configuration. When I try to use 'system.web/sessionState=App_Data\sessionstate.config', I encounter the same error about a missing section:
I'm having the same issue - I need to change some elements within system.web but pointing to system.web/compilation or system.web/identity produces the same missing section error...
wrayx1
Member
326 Points
91 Posts
Cannot find system.web section
Jan 08, 2007 02:52 PM|LINK
Tried my first web deployment project today after installing latest. What I think is a simple use of it was to replace the system.web section with system.web=release.config.
However the deployment project balks with an error:
Target ReplaceWebConfigSections:
Updating web.config: RootPath = D:\Development\projects\Documentum Linker\DMLinker_deploy\Release\, ValidateSections = False, UseExternalConfigSource = False
C:\Program Files\MSBuild\Microsoft\WebDeployment\v8.0\Microsoft.WebDeployment.targets(613,9): error : web.config(1): error WDP00002: missing section system.web.
Update of web.config Failed.
Doesn't matter whether UseExternalConfigSource is true or false. As well Release.config has only a system.web section.
My web.config file as found in the deployment directory (copied from web project by the build) certainly has a system.web section and is displayed verbatim below with some of the comments shortened but not removed (in case comments are not being parsed properly). It seems like Web Deployment 2.0 cannot do basic parsing of a pretty close to standard Ajax web.config file. I cannot see any errors in the web.config below nor does VS report any. Not very useful add-in, if basic functionality is broken. My purpose was to turn tracing off, but since trace is used in multiple sections, replacing the whole section was the only logical option.
<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<!-- All *****************-->
<!--******************** Required *****************-->
<configSections>
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false"/>
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" />
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" />
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" />
</sectionGroup>
</sectionGroup>
</sectionGroup>
</configSections>
<!--******************** Required *****************-->
<!-- This .... is accessing. -->
<connectionStrings>
<add name="PGEN_IntranetConnectionString" connectionString="Data Source=jbxsa522;Initial Catalog=PGEN_Intranet;Integrated Security=True" providerName="System.Data.SqlClient"/>
</connectionStrings>
<!--******************** Required *****************-->
<appSettings>
<add key="ApplicationId" value="142"/>
<add key="ApplicationName" value="Documentum Linker"/>
<add key="ApplicationStyle" value="_css/style.css"/>
<add key="ApplicationSecure" value="false"/>
<add key="dmUsername" value="zzzdmano"/>
<add key="dmPassword" value="dmanon2003"/>
<add key="dmDocbase" value="PGD"/>
<add key="defaultTypeName" value="dm_sysobject"/>
</appSettings>
<system.web>
<!--
The <authentication> .... an incoming user.
--><
authentication mode="Windows"/><!--
Following s (with impersonate="true" --><!--
authorization><allow roles="the domain group" />
<deny users="?" />
</authorization
--><!--
Following should only be added if the IIS anonymous user has access to the Database --><!--
identity impersonate="true" /--><!--
******************** Required *****************--><!--
Change to debug="false" at Release --><
compilation debug="false"><
assemblies><
add assembly="Documentum.Interop.DFC, Version=5.2.5.12, Culture=neutral, PublicKeyToken=D8533CA61944EE9D" /><
add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" /><
add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /><
add assembly="System.Drawing.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" /><
add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /></
assemblies></
compilation><!--
******************** Required *****************--><
pages><
controls><
add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/></
controls><
tagMapping><
add tagType="System.Web.UI.WebControls.CompareValidator" mappedTagType="System.Web.UI.Compatibility.CompareValidator, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/><
add tagType="System.Web.UI.WebControls.CustomValidator" mappedTagType="System.Web.UI.Compatibility.CustomValidator, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/><
add tagType="System.Web.UI.WebControls.RangeValidator" mappedTagType="System.Web.UI.Compatibility.RangeValidator, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/><
add tagType="System.Web.UI.WebControls.RegularExpressionValidator" mappedTagType="System.Web.UI.Compatibility.RegularExpressionValidator, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/><
add tagType="System.Web.UI.WebControls.RequiredFieldValidator" mappedTagType="System.Web.UI.Compatibility.RequiredFieldValidator, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/><
add tagType="System.Web.UI.WebControls.ValidationSummary" mappedTagType="System.Web.UI.Compatibility.ValidationSummary, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/></
tagMapping></
pages><!--
******************** Required *****************--><
httpHandlers><
remove verb="*" path="*.asmx"/><
add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/><
add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/></
httpHandlers><!--
******************** Required *****************--><
httpModules><
add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/></
httpModules><!--
******************** Required *****************--><!--
This needs to be turned off (enabled="false") for Release, however it can be turned on in production if necessary to troubleshoot.Note this is coupled with the trace listener below (WebPageTraceListener)to allow System.Diagnostic.Trace to output to the Page Trace
which means that trace in the custom control can be viewed in the Trace.Axd file as well. Note also the <compilers> section
--><
trace enabled="true" requestLimit="50" mostRecent="true" pageOutput="false" localOnly="true"/></
system.web><!--
******************** Required *****************--><
system.diagnostics><!--
This is added to direct the System.Diagnostics.Trace output to the ASP.NET pageAdvantage of using a trace listener is that the output from a custom control and support classes can also be sent to the page without using the HttpContext.
implemented everywhere by adding using Trce = System.Diagnostics.Trace; and Trce.WriteLine("") statements. Works in page or in referenced components
--><
trace autoflush="false" indentsize="4"><
listeners><
add name="WebPageTraceListener" type="System.Web.WebPageTraceListener, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/></
listeners></
trace></
system.diagnostics><!--
******************** Required *****************--><
system.codedom><
compilers><!--
This is added to enable the System.Diagnostics.Trace output redirected above to go to ASP.NET, otherwise it just goes to bit bucket --><
compiler language="c#;cs;csharp" extension=".cs" compilerOptions="/d:TRACE" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="1"/></
compilers></
system.codedom><!--
******************** Required *****************--><
system.webServer><
validation validateIntegratedModeConfiguration="false"/><
modules><
add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/></
modules><
handlers><
remove name="WebServiceHandlerFactory-ISAPI-2.0"/><
add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/><
add name="ScriptResource" verb="GET" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /></
handlers></
system.webServer></
configuration>VS 2005 Web Deployment Projects customization web.config configuration web deployment project msbuild task copy global.asax application_start session_start Visual Studio 2005 Web Deployment Projects
wrayx1
Member
326 Points
91 Posts
Re: Cannot find system.web section
Jan 09, 2007 03:03 PM|LINK
After some experimentation, I found that while you cannot replace system.web section you can replace the connectionStrings section and other sections. This doesn't make a lot of sense hard coding nodes in an XML file that you can and cannot replace, plus an incredibly misleading error message when you try. The documentation on MSDN does not say anything about which sections you can and cannot replace, and this is probably a developer error in not treating the file like an XML file with a hiearchy of XML nodes. That should have been a piece of cake with standard XML functions, to remove a node and add a new one.
My suggestion for the syntax for the replacement should be a hierarchry of nodes to replace ANY node like "configuration/system.web/trace=trace.config". This does not work now even though I have seen examples suggesting there is a hiearchy.
JocularJoe
Member
323 Points
76 Posts
Re: Cannot find system.web section
Jan 30, 2007 12:57 PM|LINK
The reason you can't replace system.web is that technically it isn't a configuration section: if you look in machine.config, you'll see that it is in fact a sectionGroup:
<sectionGroup name="system.web" type="System.Web.Configuration.SystemWebSectionGroup, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<section name="anonymousIdentification"
...
However you can replace sections within system.web using the syntax you specify, except that you shouldn't specify the top-level configuration node:
- system.web/trace=trace.config
- system.web/compilation=compilation.config
... etc ...
The reason you can't replace a sectionGroup is that the add-in assembly Microsoft.WebDeployment.Tasks.dll is using the API exposed by System.Configuration.Configuration / System.Configuration.ConfigurationSection etc to do the replacement - and this API only works with configuration sections.
I agree with you that it would be better to be able to replace any node in the config file: for the purposes of replacement the distinction between a sectionGroup and a section is rather arbitrary. This could be done my modifying Microsoft.WebDeployment.Tasks.dll to use an XML API (XmlDocument etc) to do the replacement.
KTest
Member
2 Points
1 Post
Re: Cannot find system.web section
May 16, 2007 02:40 PM|LINK
I need to custom replace the sessionState property depending on the configuration. When I try to use 'system.web/sessionState=App_Data\sessionstate.config', I encounter the same error about a missing section:
Error 5 web.config(1): error WDP00002: missing section system.web/compilation.
Any ideas on what else I could try here?
gchq
Member
119 Points
126 Posts
Re: Cannot find system.web section
Feb 12, 2008 05:21 PM|LINK
I'm having the same issue - I need to change some elements within system.web but pointing to system.web/compilation or system.web/identity produces the same missing section error...