binding type basichttpbinding instance not found in config.

Apr 1 2010 3:30 PM

I am developing a silverLight application, in this application I add a WCF service which suppose to listen to request to retrieve data from database and return to silverlight application, but when I try to call this service, I get "Could not find default endpoint element that references contract 'ServiceReference1.IGeoDbWCF' 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."

error, I wonder what is the cause and how can I solve this problem, can anyone help. Thank you in advance.
the attached is the code in my application.

in silverLight application I call the service as following.


private void btnMoreData_Click(object sender, RoutedEventArgs e)
{
try

   ServiceReference1.
GeoDbWCFClient dataService = new ppicpipelinemapping.ServiceReference1.GeoDbWCFClient();  //this line raise above error
   dataService.getTableDataCompleted +=
new EventHandler<ppicpipelinemapping.ServiceReference1.getTableDataCompletedEventArgs>   (DataService_Completed); 
   dataService.getTableDataAsync(sTableName, sWhereClause); 
   dataService.CloseAsync();
}
catch (Exception ex) { MessageBox.Show("error calling web service: " + ex.Message); }
}
private void DataService_Completed(object sender, ServiceReference1.getTableDataCompletedEventArgs e)

   Dictionary<string, string> d = e.Result; 
   MessageBox.Show("Data returned: " + d.Count);
}


In my WCF service I have the following codes:


    public class GeoDbWCF : IGeoDbWCF

    {

        #region IGeoDbWCF Members

 

        Dictionary<string, string> IGeoDbWCF.getTableData(string tableName, string whereClause) //will replace with sql codes

        {

            Dictionary<string, string> d = new Dictionary<string,string>();

            d.Add("CustomerID", "186");

            d.Add("Name", "John");

            d.Add("SRC", "WCF Test data");

            return d;

        }

 

        #endregion

    } 
the following is the content of serviceReference.clientconfig
 

<configuration>

    <system.serviceModel>

        <bindings />

      <client>

        <endpoint binding="BasicHttpBinding" bindingConfiguration="BasicHttpBinding"

                  address="http://localhost/ppicpipelinemapping.Web/GeoDbWCF.svc"

                  contract="ServiceReference1.ServiceContract.IGeoDbWCF"/>

      </client>

 

    </system.serviceModel>

</configuration>

 


Answers (1)