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.