我正在使用SL 4和带有PollingDuplexHttpBinding的.net-4 WCF服务。从服务调用服务并调用客户端工作正常。但是,只要我在不等待异步回答的情况下调用该服务15次,就会在获得0,1或2个成功答案后收到TargetInvocationException。
我的服务属性是:
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single,
ConcurrencyMode = ConcurrencyMode.Multiple)]
这是在我的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>
就像这样,我在客户端实例化服务:
var binding = new PollingDuplexHttpBinding(PollingDuplexMode.MultipleMessagesPerPoll)
{
MaxBufferSize = 2147483647,
MaxReceivedMessageSize = 2147483647
};
_service = new ServiceClient(new InstanceContext(this),
binding,
new EndpointAddress("path to .svc"));
因为我是WCF的新手:我错过了什么吗?
答案 0 :(得分:2)
TargetInvocationException应该有一个包含实际异常的InnerException属性,它可能会给你一些线索。
答案 1 :(得分:0)
不,它没有提供任何线索。远程服务器返回错误Not Found。
对异步的调用已完成,但它永远不会进入服务器,并且会立即收到回调中的错误