I am building a WPF 3.5 desktop application that has a self-service WCF service.
The service has a PollingDuplexHttpBinding endpoint defined as follows:
public static void StartService()
{
var selfHost = new ServiceHost(Singleton, new Uri("http://localhost:1155/"));
selfHost.AddServiceEndpoint(
typeof(IMyService),
new PollingDuplexHttpBinding(PollingDuplexMode.MultipleMessagesPerPoll) {ReceiveTimeout = new TimeSpan(1,0,0,0)},
"MyService"
);
ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
smb.HttpGetEnabled = true;
selfHost.Description.Behaviors.Add(smb);
selfHost.AddServiceEndpoint(typeof(IPolicyRetriever), new WebHttpBinding(), "").Behaviors.Add(new WebHttpBehavior());
selfHost.Open();
}
Note. IPolicyRetriever is a service that allows me to define a policy file
This works, and I can see my service in the Silverlight client application. Then I create a proxy server link in Silverlight code as follows:
EndpointAddress address = new EndpointAddress("http://localhost:1155/MyService");
PollingDuplexHttpBinding binding = new PollingDuplexHttpBinding(PollingDuplexMode.MultipleMessagesPerPoll);
binding.ReceiveTimeout = new TimeSpan(1, 0, 0, 0);
_proxy = new MyServiceClient(binding, address);
_proxy.ReceiveReceived += MessageFromServer;
_proxy.OrderAsync("Test", 4);
And it also works great, communication works!
But if I leave it alone (i.e. did not send messages from the server) for more than 1 minute, try sending a message to the client from the WPF server application, I get errors like this:
IOutputChannel 00:01:00. -, SendTimeout Binding. , , , -.
localhost, , 1- . , , - .
, ,
, System.ServiceModel.Channels.ServiceChannel, ,
, ?