0
votes

I'm encountering a problem when creating the WCF service client object.

HelloServiceClient helloWorldClient = new HelloServiceClient("BasicHttpBinding_IDataAccess");

Here's the content of my ServiceReferences.ClientConfig

<configuration>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_IDataAccess" maxBufferSize="2147483647"
            maxReceivedMessageSize="2147483647">
          <security mode="None" />
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost:8732/Design_Time_Addresses/HelloWcf/Service1/mex" binding="basicHttpBinding"
          bindingConfiguration="BasicHttpBinding_IDataAccess" contract="IHelloService"
          name="BasicHttpBinding_IDataAccess" />
    </client>
  </system.serviceModel>
</configuration>

The error message is as following

System.InvalidOperationException: Could not find endpoint element with name 'BasicHttpBinding_IDataAccess' and contract 'ServiceReference1.IHelloService' 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 name could be found in the client element. at System.ServiceModel.Description.ConfigLoader.LoadChannelBehaviors(ServiceEndpoint serviceEndpoint, String configurationName) at System.ServiceModel.ChannelFactory.ApplyConfiguration(String configurationName) at System.ServiceModel.ChannelFactory.InitializeEndpoint(String configurationName, EndpointAddress address) at System.ServiceModel.ChannelFactory1..ctor(String endpointConfigurationName, EndpointAddress remoteAddress) at System.ServiceModel.EndpointTrait1.CreateSimplexFactory() at System.ServiceModel.EndpointTrait1.CreateChannelFactory() at System.ServiceModel.ClientBase1.CreateChannelFactoryRef(EndpointTrait1 endpointTrait) at System.ServiceModel.ClientBase1.InitializeChannelFactoryRef() at System.ServiceModel.ClientBase`1..ctor(String endpointConfigurationName) at SilverlightApplication1.ServiceReference1.HelloServiceClient..ctor(String endpointConfigurationName) at SilverlightApplication1.MainPage.Button_Click(Object sender, RoutedEventArgs e)

Could someone help me on this problem? and please do let me know if you want any other codes/config.

1
Is it not as simpel as your contract name needs to be 'ServiceReference1.IHelloService' that would tie in with my file. VS will auto generate them for youBugFinder
That works. Many Thanks.Alvin
Please then mark the answer below correct - it helps with your rep and makes the site workBugFinder

1 Answers

0
votes

As found above - the contract name needs to be 'ServiceReference1.IHelloService' as indicated in the error.