WCF endpoint url replacement

Most of our config files have wcf endpoints in them that vary based on environment:

<endpoint address="http://dev.foo.com/bar.svc"

<endpoint address="http://qa.foo.com/bar.svc"

<endpoint address="http://foo.com/bar.svc"

What’s the suggested method for replacing them out?

Hi Kevin,

XML config transforms are probably the easiest way to go. The only issue is it’s tricky to parameterize - you’d need a Web.Dev.config, Web.QA.config, Web.Production.config.

Another option would be to have PowerShell perform an XPath replacement. Then the URL’s can be defined as variables in the Octopus UI, and PowerShell will get the variables and can replace them in the XML.


I’ve added a task to the backlog to try and match endpoints by contract name - so if you have a setting named Foo.Bar.IMyService, and give it a value, I’ll find the endpoint for that contract and replace the address.

1 Like