Home > Dynamics Ax > Dynamics Ax –AIF –Web Services –Service end point error

Dynamics Ax –AIF –Web Services –Service end point error


Error: Could not find default endpoint element that references contract ‘CustomerService.CustomerService’ 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.


I had come across this error, while accessing the Dynamics Ax – AIF – Customer service from .Net windows user control.

Work around, to solve the above error:                                                     Reference from #MSDN


using System.ServiceModel;


//Configures the security settings of a basicHttpBinding binding.

                System.ServiceModel.BasicHttpBinding binding =

                new System.ServiceModel.BasicHttpBinding(BasicHttpSecurityMode.TransportCredentialOnly);

                binding.Name = "BasicHttpBinding_CustomerService";

                binding.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard;

                binding.Security.Mode = BasicHttpSecurityMode.Message;


                BasicHttpSecurity mySecurity = binding.Security;

                mySecurity.Transport.ClientCredentialType = HttpClientCredentialType.Windows;

                mySecurity.Mode = BasicHttpSecurityMode.TransportCredentialOnly;

                mySecurity.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;


                HttpTransportSecurity transSec = mySecurity.Transport;                           


                EndpointAddress endpointAddress = new EndpointAddress("http://ban-srv-ax.digimakerbengaluru.com/MicrosoftDynamicsAXAif50/customerservice.svc");


//Calling the Ax Service by passing the Binding and endPoint Address object, becuase, while calling this

//web service from user control we are not able to find the endpoint address of the service.

//i.e. It’s not able to read out the exact endpoint address from config file.

    CustomerServiceClient   myCustomerService = new CustomerServiceClient(binding, endpointAddress);


                EntityKey[] custAcc = myCustomerService.create(cust);

                MessageBox.Show("Created the customer and CustomerId is:" + custAcc[0].KeyData[0].Value, "Customer");


This is work around. In case we are able to access the CustomerService from IIS, but we are not able to create the proxy object for accessing the service in C# project.  

Categories: Dynamics Ax
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: