Question

I have just started using web.config transformation and I am able to apply successfully replace transformation. however I am struggling with little more complex transformation such as

<downloadHandlers>
  <add name="FileDownload" path="~/Download.ashx">
    <tcpDownloadEndpoint endpointIPAddress="127.0.0.1" endpointPort="8100" />
  </add>
</downloadHandlers>

I have the following line in the transformation file to replace the local IP with UAT IP for UAT env.

<tcpDownloadEndpoint 
endpointIPAddress="127.127.0.1"
xdt:Transform="SetAttributes(endpointIPAddress)">
</tcpDownloadEndpoint >

But the above code has no effect and the IP in the web.config still contains the local IP after transformation.

I am using Visual Studio 2010 with web.config transformation plugin written by Syed Hashmi (MS).

Can any one please tell me what I am doing wrong.

thanks

Was it helpful?

Solution

You should use the following in your transformation web.config:

<downloadHandlers>
  <add name="FileDownload" path="~/Download.ashx">
    <tcpDownloadEndpoint
  endpointIPAddress="127.127.0.1"
  xdt:Transform="SetAttributes(endpointIPAddress)">
    </tcpDownloadEndpoint >
  </add>
</downloadHandlers>

You need to use the complete XML node hierarchy when specifying a transform. By removing the outer nodes, the web.config transformation can't find the exact node that you want to transform.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top