I'm using SL 4 and a .net-4 WCF service with a PollingDuplexHttpBinding. Calling the service and calling the client back from the service works fine. But as soon as I call the service, say 15 times without waiting for the async answer, I receive a TargetInvocationException after getting 0, 1 or 2 successful answers.
My attributes for the service are:
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single,
ConcurrencyMode = ConcurrencyMode.Multiple)]
This is in my web.config:
<behaviors>
<serviceBehaviors>
<behavior name="RecordProviderServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
<serviceTimeouts transactionTimeout="05:05:00" />
<serviceThrottling maxConcurrentCalls="500" maxConcurrentSessions="500"
maxConcurrentInstances="2147483647" />
</behavior>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
<bindings>
<pollingDuplexHttpBinding>
<binding name="multipleMessagesPerPollPollingDuplexHttpBinding"
maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
maxOutputDelay="00:00:00.200" duplexMode="MultipleMessagesPerPoll" />
</pollingDuplexHttpBinding>
</bindings>
And like this, I instantiate the service on client side:
var binding = new PollingDuplexHttpBinding(PollingDuplexMode.MultipleMessagesPerPoll)
{
MaxBufferSize = 2147483647,
MaxReceivedMessageSize = 2147483647
};
_service = new ServiceClient(new InstanceContext(this),
binding,
new EndpointAddress("path to .svc"));
As I'm new to WCF: did I miss something?