I have a SharePoint workflow which calls a WCF service. This works fine so long as the workflow runs under IIS and is not shifted to the Timer Service.
The problem is that the Timer Service does not have access to the web.config settings it needs to setup the WCF connection from the context of the Timer Service.
Could not find endpoint element with name endpointname' and contract 'servicecontractname' in the ServiceModel client configuration section
I am setting up all the info WCF needs to make the connection in code anyway (and overriding the values set in web.config)
My question is, can I bypass this config entirely? I’d rather not be dependent on several ettings files and keeping them in sync.
Update
This little bit of code did the trick.
string address = "http://myservice.com/soap.svc";
Binding binding = new System.ServiceModel.BasicHttpBinding();
EndpointAddress endpointAddress = new EndpointAddress(address);
client = new MyServiceClient(binding, endpointAddress);
Thanks for the input!
Sure – you can do all configuration in code.
http://en.csharp-online.net/WCF_Essentials%E2%80%94Programmatic_Endpoint_Configuration