WCF Client configuration - redirect multiple services to another host?

You'll need to do it via code - there's no "wildcard" in config which you can use for the base address in the system. ServiceModel / client section. You can, however, have some placeholder in config (like "localhost") and in code first load the config, then update the server name with the actual value (which can be stored in config as well, e.g. , in the AppSettings, or somewhere else) var factory = new ChannelFactory("ServiceA"); factory.Endpoint.

Address = ReplaceServerName(factory.Endpoint. Address); var proxy = factory.CreateChannel().

You'll need to do it via code - there's no "wildcard" in config which you can use for the base address in the section. You can, however, have some placeholder in config (like "localhost") and in code first load the config, then update the server name with the actual value (which can be stored in config as well, e.g. , in the AppSettings, or somewhere else). Var factory = new ChannelFactory("ServiceA"); factory.Endpoint.

Address = ReplaceServerName(factory.Endpoint. Address); var proxy = factory.CreateChannel(); ...

1 yeah, I guess this would be the only halfway manageable solution for the client side - too bad there's no "base address" concept on the client side... – marc_s Aug 4 at 15:04.

Right now, I have multiple services in my client web. Config makes switching between hosting environments difficult and error-prone, because you need to replace the "hostname" on all and each one of the endpoint addresses. I want to somehow add an environment app setting or something somewhere that will let me specify a host, and have the endpoint be resolved like http://{hostA}/ServiceX.

Do I need to do some magic programmatically or can I do this from configuration alone?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions