开发者

TargetInvocationException on multiple WCF-service calls

开发者 https://www.devze.com 2023-01-01 16:12 出处:网络
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 w

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?


TargetInvocationException should have a InnerException property containing the actual exception, it might give you some clues.


No it doesn't give any clue. The remote server return an error Not Found.

The call to async is done, but it never go to the server and it gets immediately the error in the callback

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号