Last post May 24, 2016 10:47 AM by mgebhard
Jun 20, 2013 12:56 PM|desertfoxaz|LINK
I've been tasked to create a WCF service that will perform copy files on a web server from one location to another on the same disk. Basically we're copying files from a template folder to another to support customer themes on our website.
In our development environment there is only one server where this will happend but in production there are two. That number could increase in the future.
I have created my service reference in the development environment and everything works, but I need to figure out how to support 2 or more. If could create multiple references, but I see a drawback that I'd have to do a new build whenever a new one comes
along because I'll need coding changes. I've been investigating using one service reference and programmatically setting the endpoint address. They way I've tried to do this is to have all the endpoint info in the web.config and then using code like the
EndpointAddress address = new EndpointAddress("http://...);
ServiceClient client= new ServiceClient("MyBinding", address):
I was thinking of storing the endpoint addresses either in a database or in a custom configuration section in the web.config.
Is this sufficient? Is there anything I need to look out for doing this?
May 23, 2016 05:11 PM|march11|LINK
Not sure I understand this....
I see a drawback that I'd have to do a new build whenever a new one comes along
New one what? Server? Theme?
You shouldn't have to do this as themes are added. A new server though and you would likely need to rebuild.
But the service you create should call a non-WCF function so the file theme handling is performed there. Do not do the work in your WCF call. Just pass it to a backend worker.
If the back end worker needs to update, no big deal, its just like pushing a page update.
but if you were referring to a new server then yes you would need to store the endpoints and add logic to decide on which to use. Add and Active/Inactive flag as well. I have done that in the past and it saves a lot if one goes down or is decommissioned.
May 24, 2016 10:47 AM|mgebhard|LINK
The question is not clear. Is this a load balancing question? If so, you'll need a copy of the service on both load balanced machines and a load balancer.
For copying the files in load balanced environment, simply create a single network location to store the files. That could be SQL server, one of the web servers, a network share, etc...