locked
Web.Config transformation issue RRS feed

  • Question

  • User-137472927 posted

    Hi All,

    I have a Web.config file in Web API application with below <handlers> section: 

    <handlers>
          <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
          <remove name="OPTIONSVerbHandler" />
          <remove name="TRACEVerbHandler" />
          <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
        </handlers>

    I have production Web.Config transformation of this file- Web.Prod.Config in which I want to replace second tag:   

    <remove name="OPTIONSVerbHandler" />

    with:

    <remove name="OPTIONS" />

    I have tried to achieve this with below xdt transformations in Web.Prod.Config file: 

        <handlers>
          <remove name="OPTIONS" xdt:Transform="Insert" />
          <remove name="OPTIONSVerbHandler" xdt:Transform="Remove" />
        </handlers>

    But it resulted in below transformed Web.Prod.Config file which is incorrect and resulted in error: 

    <handlers>
          <remove name="OPTIONSVerbHandler" />
          <remove name="TRACEVerbHandler" />
          <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
        <remove name="OPTIONS" />
    </handlers>

    Please suggest how can I generate the required Transformed file Web.Prod.Config for Prod environment ASAP.

    Thanks,

    Pratham 

    Tuesday, March 16, 2021 8:03 AM

All replies