I have added wcf service in "Windows Service" as service reference. but when i try to create instance it simply gives me following error
"Could not find default endpoint element that references contract 'ServiceReference1.IClientService' 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."
Code
pushNotification push_notification = new pushNotification();
var proxy = new ServiceReference1.ClientServiceClient();
using (var scope = new OperationContextScope(proxy.InnerChannel))
{
// Add a HTTP Header to an outgoing request
HttpRequestMessageProperty requestMessage = new HttpRequestMessageProperty();
requestMessage.Headers["Authorization"] = "Push Notification";
OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = requestMessage;
push_notification = proxy.GetPendingNotification();
}
app.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService1" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:4567/ClientService.svc" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IService1" contract="ServiceReference1.IClientService"
name="BasicHttpBinding_IService1" behaviorConfiguration="webHttpBehavior" />
</client>
<behaviors>
<endpointBehaviors>
<behavior name="webHttpBehavior">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
app.config
file? – BelogixServiceModel
section.. – Sachin