locked
Web.config file replacement RRS feed

  • Question

  • User1618900539 posted
    Hi!!
    When I try to build a Web deployment project, if I want to replace the <compilation> section inside <system.web> I keep on getting this error: web.config(1): error WDP00002: missing section compilation.

    I've tried to use the whole system.web branch or just the compilation branch into the replacement file, with no luck.

    Any idea on this??
    Is there a source of documentation about web.config replacement best procedures? I couldn't find anything on the Internet.

    Thanks!!
    Juan
    Monday, April 17, 2006 6:45 PM

Answers

  • User811575682 posted
    Hi!!
    When I try to build a Web deployment project, if I want to replace the <compilation> section inside <system.web> I keep on getting this error: web.config(1): error WDP00002: missing section compilation.
     [..]
    Any idea on this??


    system.web/compilation=myCompilation.config

    Works great.
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, April 24, 2006 8:22 AM

All replies

  • User811575682 posted
    Hi!!
    When I try to build a Web deployment project, if I want to replace the <compilation> section inside <system.web> I keep on getting this error: web.config(1): error WDP00002: missing section compilation.
     [..]
    Any idea on this??


    system.web/compilation=myCompilation.config

    Works great.
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, April 24, 2006 8:22 AM
  • User290243610 posted
    Hi!

    What about <system.net> section?
    I store smtp parameters there but when I set system.net/mailSettings=myParam.config I recevied the following error:
    C:\Program Files\MSBuild\Microsoft\WebDeployment\v8.0\Microsoft.WebDeployment.targets(613,9): error : web.config(1): error WDP00002: missing section system.net/mailSettings.

    There is my web.config:
    	<system.net>
    		<mailSettings>
    			<smtp deliveryMethod="network">
    				<network
              host="exchange"
              port="25"
              defaultCredentials="true"
            />
    			</smtp>
    		</mailSettings>
    	</system.net>
    
     and there is myParam.config:
    <system.net>
     <mailSettings>
      <smtp deliveryMethod="network">
    	  <network
          host="mail.host.com"
          port="25"
          defaultCredentials="true"
        />
      </smtp>
    </mailSettings>
    </system.net>
     Thank in advance
    Tuesday, April 25, 2006 10:35 AM
  • User811575682 posted
    Hi!
    What about <system.net> section?

    You can exchange every section.

    I store smtp parameters there but when I set system.net/mailSettings=myParam.config I recevied the following error:
    [....]
    <system.net>
     <mailSettings>
    [....]
    </mailSettings> </system.net>

    If you want to replace the system.net/mailSetting your myParam.config must only held
    the section you want to replace. In your case without <system.net>

    <mailSettings>
    <smtp deliveryMethod="network">
    <network
    host="mail.host.com"
    port="25"
    defaultCredentials="true"
    />
    </smtp>
    </mailSettings>

    Friday, April 28, 2006 1:25 PM
  • User-1320355269 posted

    I really need your help.  

    I am following the directions but this just isn't working for me - I get the same error WPD error - can you help?

    ERROR:

    ----------------------------------------------------------

    C:\Program Files\MSBuild\Microsoft\WebDeployment\v8.0\aspnet_merge.exe C:\precompile\ClientSurvey1_deploy -o ClientSurvey1 -debug -copyattrs

    Successfully merged 'C:\precompile\ClientSurvey1_deploy'.

    Updating web.config: RootPath = C:\precompile\ClientSurvey1_deploy\, ValidateSections = False, UseExternalConfigSource = False

    C:\Program Files\MSBuild\Microsoft\WebDeployment\v8.0\Microsoft.WebDeployment.targets(513,9): error : web.config(1): error WDP00002: missing section system.web/compilation.

    Update of web.config Failed.

     

    Web.config
    -----------------------------------------------

      <system.web>

      <pages styleSheetTheme="White"/>
      <
    customErrors mode="Off"
    /> 
    <
    compilation debug="false"
    >
      :
      :
      </compilation >

     

    "webconfigCompilation.config"
    -----------------------------------------------

    <compilation debug="false" />

     

    Web Deployment Project:

    ---------------------------------------------

    system.web/compilation=webconfigCompilation.config;

     

    Thanks in advance

    Wednesday, June 21, 2006 3:32 PM
  • User-644150317 posted

    Not sure if you are still experiencing this problem.

    I was having no end of grief trying to use the web.config section replacement, especially when working with  Enterprise Library. I decided to swap out the entire config file instead, I also find this easier to maintain.

    In my solution I have a Web.config (Debug), Web.Staging.config and Web.Release.config.

    I edit the Deployment Project file directly. Right click on the Web Deployment Project and select Open Project File.

    You will see the xml that represents the project. I added the following: 

      <Target Name="AfterBuild">
        <!--Web.config -->
        <Copy Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " SourceFiles="$(SourceWebPhysicalPath)\Web.Release.config" DestinationFiles="$(OutputPath)\Web.config" />
        <Copy Condition=" '$(Configuration)|$(Platform)' == 'Staging|AnyCPU' " SourceFiles="$(SourceWebPhysicalPath)\Web.Staging.config" DestinationFiles="$(OutputPath)\Web.config" />
         <!--Delete extra files -->
        <Delete Files="$(OutputPath)\Web.Release.config" />
        <Delete Files="$(OutputPath)\Web.Staging.config" />
      </Target>

     This replaces the entire Web.config and then deletes the unneeded files.

    Hope this help.

    Thursday, July 27, 2006 1:57 PM
  • User-1320355269 posted
    Thanks - I was still having the problem.  Don't know how but I had gotten it to work once before but never since.  Looks like this forum isn't monitored frequently..


    Thanks for ideas! I'll try that too.

    Thursday, July 27, 2006 4:45 PM
  • User877999272 posted

    egorush - Great idea! I've been having issues with the replacements; it couldn't load my custom config sections...this sure makes it simpler!

    Possibly as a feature request in a future version of the deployment project...a way to edit the build events in the UI?

    Thanks,
    John

    Monday, August 7, 2006 11:38 AM
  • User-887401949 posted

    Hi!!
    When I try to build a Web deployment project, if I want to replace the <compilation> section inside <system.web> I keep on getting this error: web.config(1): error WDP00002: missing section compilation.
     [..]
    Any idea on this??


    system.web/compilation=myCompilation.config

    Works great.

     Can I ask, what is the content/format of myCompilation.config in this case?

    Wednesday, September 6, 2006 3:47 PM
  • User-887401949 posted

    Hi!!
    When I try to build a Web deployment project, if I want to replace the <compilation> section inside <system.web> I keep on getting this error: web.config(1): error WDP00002: missing section compilation.
     [..]
    Any idea on this??


    system.web/compilation=myCompilation.config

    Works great.

     Can I ask, what is the content/format of myCompilation.config in this case?

    Because I got "The format of a configSource file must be an element containing the name of the section. (C:\Work\MyProject\Debug\myCompilation.config line 10)" error. [^o)]

    Wednesday, September 6, 2006 4:01 PM
  • User1009323531 posted

    I have prob. with this apporach. My file dosent get swapped... Are your replacement files complete config files with the exception of the changes or just the changes you want to make?
    The <Delete> tag seems to work because the file dosent show up if its there, but ends up on the server location if its not. BUT my web.config file is just the same, no changes.
    I have placed the config file with the website/project (added new textfile with config extension), is that where the <Copy> tag looks for it?

    Best regards

    Mikael

    Monday, August 27, 2007 5:54 AM
  • User1587141132 posted

     Hi Rasetti,

    Did you ever find a resolution to replacing your <mailSettings> section?

    I have the same problem, and I've tried every combination of specifying 'mailSettings=releaseMailSettings.config', 'system.net/mailSettings=releaseMailSettings.config', etc. In the .config file I've tried including only the <mailSettings> elements and including the '<system.net><mailSettings>...' elements as well.

    No matter how I do it, I receive the same WDP00002: mission section compilation exception. The connectionStrings= sections works fine however.

     
    Cheers,
    Scott
     

    Sunday, April 6, 2008 8:10 PM
  • User1727561060 posted

    I have it working this way:

    Deployment setting
    system.net/mailSettings/smtp=Configurations\DEV\systemNet_mailSettings_smtp_DEV.config;  

    My Replacement config file 
    <smtp deliveryMethod="PickupDirectoryFromIis" from="username@server.co.uk">
     
    <network host="smtp.server.co.uk" password="xxxx" port="123" userName="username" />
    </smtp>  

    My problem now is when I add a custom configSection 

    My web.config looks like this: 
    <configSections>
      <
    section name="mySection" type="MyProject.MySectionClass, __code"/>
    </configSections> <mySection defaultConnectionStringName="LocalSqlServer">     
      <mySubSection
    mailto=”meTest”>
    </mySection>
     

    And my replacement file is
    <mySubSection mailto="meProd"/> 

    Deployment setting
    mySubSection=Configurations\PROD\mySubSection_PROD.config 

    but obviously it is wrong as I get the web.config(1) error too. 

    Anyone had any luck with the custom configSections?

    Sunday, June 29, 2008 1:47 AM
  • User845833813 posted

    Looks like you are not closing out your subsection in your web.config ....

     <mySubSection mailto=”meTest”>

    instead of

     <mySubSection mailto=”meTest” />

    The replacement process has to know where to start and end to do the replacement.

    Friday, August 1, 2008 3:02 PM
  • User-592590055 posted

     I am getting an error when I am trying to replace a urlrewritingnet section of my webconfig:

    web config:

    <urlrewritingnet rewriteOnlyVirtualUrls="true" contextItemsPrefix="QueryString" defaultPage="Default.aspx" defaultProvider="RegEx" xmlns="http://www.urlrewriting.net/schemas/config/2006/07">
      <rewrites>
        <add name="PublishPortfolio2" virtualUrl="^https\://urlhere/(.*).aspx" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/public/Default.aspx?username=$1" rewrite="Domain" ignoreCase="true"/>
        <add name="PublishPortfolio1" virtualUrl="^https\://urlhere/(.*)" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/public/Default.aspx?username=$1" rewrite="Domain" ignoreCase="true"/>
      </rewrites>
    </urlrewritingnet>

    Web Deployment file:

      <WebConfigReplacementFiles Include="config\live_urlrewriting.config">
          <Section>urlrewritingnet</Section>
        </WebConfigReplacementFiles>

     Error :    An error occurred creating the configuration section handler for urlrewritingnet: Could not load file or assembly 'UrlRewritingNet.UrlRewriter' or one of its dependencies. The system cannot find the file specified.

    I have also tried just replacing the <rewrites> section by changing the replacement config file to

      <rewrites>
        <add name="PublishPortfolio2" virtualUrl="^https\://urlhere/(.*).aspx" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/public/Default.aspx?username=$1" rewrite="Domain" ignoreCase="true"/>
        <add name="PublishPortfolio1" virtualUrl="^https\://urlhere/(.*)" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/public/Default.aspx?username=$1" rewrite="Domain" ignoreCase="true"/>
      </rewrites>

    and the web deployment file to 

       <WebConfigReplacementFiles Include="config\live_urlrewriting.config">
          <Section>urlrewritingnet/rewrites</Section>
        </WebConfigReplacementFiles>

    but this produces the WDP00002 section not found error.

     

    any help appreciated

    Thursday, February 5, 2009 11:19 AM