多个 WCF 服务调用上的 TargetInitationException
我正在使用 SL 4 和 .net-4 WCF 服务以及 PollingDuplexHttpBinding。调用服务并从服务回调客户端效果很好。但是,一旦我调用该服务(例如 15 次)而无需等待异步答案,我就会在获得 0、1 或 2 个成功答案后收到 TargetInitationException。
我的服务属性是:
[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 新手:我错过了什么吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
TargetIncationException 应该有一个包含实际异常的 InnerException 属性,它可能会给您一些线索。
TargetInvocationException should have a InnerException property containing the actual exception, it might give you some clues.
不,它没有给出任何线索。远程服务器返回错误“未找到”。
对 async 的调用已完成,但它永远不会到达服务器,并且会立即在回调中收到错误
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