3
votes

i have written a simple wp7 application. it uses wcf service and files to store user provided data. i could successfully run the app without errors but i am getting a runtime err: "An endpoint configuration section for contract 'ServiceReference1.IService1' could not be located because more than one endpoint configuration for that contract was found. please indicate the preferred endpoint configuration section by name" the acf contains the following endpoint configurations set

 <services>
      <service name="WcfDataWallet.Service1">
        <endpoint address="" binding="basicHttpBinding" bindingConfiguration="NewBinding0"
          contract="WcfDataWallet.IService1">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />

can someone help me please

2

2 Answers

3
votes

I just had this same issue. I only added 1 Service Reference to my project in VS 2010, however, I noticed that in web.config 2 endpoints were added

I just commented out the second endpoint as I'm fairly certain that I don't need it.

Thus before

<endpoint address="http://web_services.u.aco/ServicesLocations/1_1/LocationsService.svc"
    binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_ILocationsService"
    contract="LocationService.ILocationsService" name="WSHttpBinding_ILocationsService" />
  <endpoint address="http://web_services.u.aco/ServicesLocations/1_1/LocationsService.svc/basic"
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ILocationsService"
    contract="LocationService.ILocationsService" name="BasicHttpBinding_ILocationsService" />

Changed to:

<endpoint address="http://web_services.u.aco/ServicesLocations/1_1/LocationsService.svc"
    binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_ILocationsService"
    contract="LocationService.ILocationsService" name="WSHttpBinding_ILocationsService" />
  <!--<endpoint address="http://web_services.u.aco/ServicesLocations/1_1/LocationsService.svc/basic"
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ILocationsService"
    contract="LocationService.ILocationsService" name="BasicHttpBinding_ILocationsService" />-->

Works Now!

0
votes

try this

MyClientProxy proxy = new MyClientProxy("endpoint name"); eg EndPointNameXXX

Where "endpoint name" should be pointing to one of your endpoints in client config file.

<endpoint address="http://[SERVER]/Service"
                binding="basicHttpBinding" bindingConfiguration="bindingConfig"
                contract="IXXXX.YYYY" name="EndPointNameXXX" />