By default, when you do an Add Service Reference operation, the WCF runtime will generate the client-side proxy for you. The simplest way to use it is to instantiate the client proxy with a constructor that takes no parameters, and just grab the info from the app.config : YourServiceClient proxy = new YourServiceClient(); This requires the config file to have a <client> entry with your service contract - if not, you'll get the error you have. But the client side proxy class generated by the WCF runtime also has additional constructors - one takes an endpoint address and a binding, for instance: BasicHttpBinding binding = new BasicHttpBinding(); binding.Security.Mode = BasicHttpSecurityMode.Transport; EndpointAddress epa = new EndpointAddress("http://example.com/api/?wsdl"); YourServiceClient proxy = new YourServiceClient(binding, epa); With this setup, no config file at all is needed - you're defining everything in code. Of course, you can also s...
Comments
Post a Comment