Could not find default endpoint element that references contract... But application still works

StackOverflow https://stackoverflow.com/questions/23632044

  •  21-07-2023
  •  | 
  •  

I am currently working on a WPF Application, using a different project to call a WebService. When I try to build i get this error:

Could not find default endpoint element that references contract
'VisitorRegistrationWebService.VisitorRegistrationWebServiceSoap' 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.

The app.config from my webservice project is just the same as the one from my WPF project.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
  <basicHttpBinding>
    <binding name="VisitorRegistrationWebServiceSoap" />
  </basicHttpBinding>
</bindings>
<client>
  <endpoint address="http://localhost/webservices/VisitorRegistrationWebService.asmx"
      binding="basicHttpBinding"   bindingConfiguration="VisitorRegistrationWebServiceSoap"
      contract="BasicVisitorRegistrationWebService.VisitorRegistrationWebServiceSoap"
      name="VisitorRegistrationWebServiceSoap" />
</client>
</system.serviceModel>
</configuration>

The strange thing is that I can run the project and use the webservice to get data, but the error will not go away, no matter how many times I clean and rebuild my solution.

有帮助吗?

解决方案

in error message, contract name is 'VisitorRegistrationWebService.VisitorRegistrationWebServiceSoap'

and in endPoint configuration, contract="BasicVisitorRegistrationWebService.VisitorRegistrationWebServiceSoap"

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top