I have a wpf C# application that calls a web service AddressValidationService. I know it used to work (before I started working on the project), but now it doesn’t. The exception happens here:
var addrSvc = new AddressValidationServiceReference.AddressValidationServiceClient();
The exception is:
Could not find default endpoint element that references contract ‘AddressValidationServiceReference.IAddressValidationService’ in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.
This is from my app.config:
<client>
<endpoint address="http://rdbval/EASTServices/AddressValidationService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IPolicyRetriever"
contract="AddressValidationServiceReference.IPolicyRetriever"
name="BasicHttpBinding_IPolicyRetriever" />
<endpoint address="http://rdbval/EASTServices/AddressValidationService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IAddressValidationService"
contract="AddressValidationServiceReference.IAddressValidationService"
name="BasicHttpBinding_IAddressValidationService" />
</client>
Maybe somebody could tell what is wrong? Thanks.
Probably stupid guess, but anyway: are you sure your config file is the one from your client application? =). try reading some AppSetting from it for example to ensure you are using the correct one if you are not sure.
The config itself looks fine.