Could Not Find Default Endpoint Element Hatasının Çözümü
Web service’inizi oluşturdunuz. Daha sonra bir client application oluşturarak bu yazmış olduğunuz service’i kullanmak için gerekli adımları gerçekleştirdiniz. Ancak Service’i kullanırken aşağıdaki gibi bir hata alıyorsunuz.
Unhandled Exception: System.InvalidOperationException: Could not find default endpoint element that references contract ‘ICustomers’ in the
ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoin
t element matching this contract could be found in the client element.
at System.ServiceModel.Description.ConfigLoader.LoadChannelBehaviors(ServiceEndpoint serviceEndpoint, String configurationName)
at System.ServiceModel.ChannelFactory.ApplyConfiguration(String configurationName, Configuration configuration)
at System.ServiceModel.ChannelFactory.ApplyConfiguration(String configurationName)
at System.ServiceModel.ChannelFactory.InitializeEndpoint(String configurationName, EndpointAddress address)
at System.ServiceModel.ChannelFactory`1..ctor(String endpointConfigurationName, EndpointAddress remoteAddress)
at System.ServiceModel.EndpointTrait`1.CreateSimplexFactory()
at System.ServiceModel.EndpointTrait`1.CreateChannelFactory()
at System.ServiceModel.ClientBase`1.CreateChannelFactoryRef(EndpointTrait`1 endpointTrait)
at System.ServiceModel.ClientBase`1.InitializeChannelFactoryRef()
at System.ServiceModel.ClientBase`1..ctor()
at CustomersClient..ctor() in C:\inetpub\wwwroot\WcfService2\ClientApp\Customers.cs:line 91
at ClientApp.Program.Main(String[] args) in C:\inetpub\wwwroot\WcfService2\ClientApp\Program.cs:line 13
Press any key to continue . . .
Hatayı çözmek için Service’i referans ettikten sonra client application’da bulunan app.config dosyası içindeki kırmızı ile belirtiğim service namespace’ini silmeniz gerekiyor. Bazılarında silmeye gerek kalmadan client’in proje adını, yani namespace’ini contract içeriğinin başına yazarak da sorunun üstesinden gelebilmiş ancak o yöntem benim sorunumu çözmedi. Bu iki yöntemden biri umarım işinize yarar.
<client><endpoint address=”http://localhost:59778/Customers.svc” binding=”wsHttpBinding”bindingConfiguration=”WSHttpBinding_ICustomers” contract=”ServiceReference1.ICustomers”name=”WSHttpBinding_ICustomers”><identity><dns value=”localhost” /></identity></endpoint></client>



