I followed some guide to consuming WCF service in my windows application. My WCF Service worked well for my mobile application but I cannot get it working on windows application.
The error generated when i try to run the code is:
Could not find default endpoint element that references contract 'AllocationService.IAllocatingService' 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.
Calling web service method:
AllocationService.AllocatingServiceClient client = new AllocationService.AllocatingServiceClient();
client.notifyZoneChanged(1);
Web Service side:
[OperationContract]
void notifyZoneChanged(int LocationID);
Web Service's web.config:
<?xml version="1.0"?>
<configuration>
<connectionStrings>
<add name="PCSDB" connectionString="Data Source=alj6d2eqa0.database.windows.net;Initial Catalog=StaffAllocatorDB;Persist Security Info=True;User ID=---;Password=---" providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<services>
<service name ="StaffAllocator.AllocatingService">
<endpoint address="" behaviorConfiguration="AllocationBehavior" binding="webHttpBinding" bindingConfiguration="" contract="StaffAllocator.IAllocatingService">
</endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="AllocationBehavior">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
App.config for windows application:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<connectionStrings>
<add name="PCSDB" connectionString="Data Source=alj6d2eqa0.database.windows.net;Initial Catalog=StaffAllocatorDB;Persist Security Info=True;User ID=---;Password=---" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="AllocationBehavior">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<endpoint Name="Default"
address="http://staffallocatingsystem.cloudapp.net/AllocatingService.svc"
binding="webHttpBinding"
behaviorConfiguration="AllocationBehavior"
contract="AllocationService.IAllocatingService" />
</system.serviceModel>
</configuration>