I have a Sharepoint 2010 webpart that calls a WCF service.
I've created a service proxy and manually coded the endpoint, see below.
In a conventional WCF client I'd use the config files for the configuration and use transforms when I was buiding for deployment to different environments.
How would I achieve the same through a Sharepoint webpart? I want to put the configuration somewhere that it can be changed for different build configurations.
ie. For a local deployment during testing, then a test server, production. We're trying to automate this as much as possible.
Thanks, Tim
UPDATE: I'm aware that you need to put config data in the web.config file in sharepoint. I'm looking for a way to put these config settings into source control and have them automatically populate / deploy for different builds and environments.
namespace CombinedPortal.WcfClient { public class FrameworkServiceProxy : IFrameworkService { private IFrameworkService _proxy;
public FrameworkServiceProxy() { var endpoint = new EndpointAddress("http://server:1234/FrameworkService.svc"); var binding = new WSHttpBinding(SecurityMode.None); _proxy = new ChannelFactory<IFrameworkService>(binding, endpoint).CreateChannel(); } public Framework GetCurrentFramework(double uniqueLearnerNumber) { var fw = _proxy.GetCurrentFramework(uniqueLearnerNumber); return fw; } } }