The reason you get that error is that the default constructor for a WCF client proxy looks up the channel configuration from local config. You can override this behavior by specifying the binding and address you want to use / connect to.
You have several options here, each with a different deployment model.
- Hardcode the endpoint information in your "Gateway" library (the common term for this is "proxy"). You would just return new DBInteractionGatewayClient(binding, address); For this solution, you'd only distribute the assembly your WSGateway code was in (hereafter called "WSGateway Assembly".
- Create a common configuration file that all sites have access to. If these are all services on the same machine, this is easy to do. Place configuration data in a shared common drive location and read it from there. If you want the full gamut of possible WCF configuration to be available, you'd need to use the ConfigurationManager.OpenMappedExeConfiguration method and read it manually and apply it manually to your binding before your open the client channel. For this you would ensure you centrally located config file was accessible and distribute you WSGateway Assembly.
- Move your configuration to a common resource accessible from all applications, like a database. This would allow you to access this configuration data from any point in your solution. For this solution, you would ensure your configuration database was accessible from all points in your solution and distribute your WSGateway Assembly.
These are the solutions I could think of off the top of my head. Let us know what you decide to do.
Anderson Imes
2009-04-14 02:50:21