我收到来自 WCF 客户端的“无法处理消息...”错误。请帮助,它正在杀死我。
我有一个测试获胜应用程序,它通过一个for循环来启动x个异步调用。每个异步调用都会实例化它自己的 WCF 代理实例,并使用该代理调用 WCF 服务。如果x约为 35 或更小,则一切正常。如果x > 40 左右,许多调用都可以正常完成,但少数会返回:
System.ServiceModel.Security.MessageSecurityException:
An unsecured or incorrectly secured fault was received from the other party.
See the inner FaultException for the fault code and detail. --->
System.ServiceModel.FaultException: The message could not be processed.
This is most likely because the action 'http://tempuri.org/IMyService/MakeRequest'
is incorrect or because the message contains an invalid or expired
security context token or because there is a mismatch between bindings.
The security context token would be invalid if the service aborted
the channel due to inactivity. To prevent the service from aborting
idle sessions prematurely increase the Receive timeout on the
service endpoint's binding.
--- End of inner exception stack trace ---
Server stack trace:
at System.ServiceModel.Security.SecuritySessionClientSettings`1.SecurityRequestSessionChannel.ProcessReply(Message reply, TimeSpan timeout, SecurityProtocolCorrelationState correlationState)
at System.ServiceModel.Security.SecuritySessionClientSettings`1.SecurityRequestSessionChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at ...
我正在使用具有消息安全性的客户端和服务器端证书。我不明白为什么它只运行了一定次数,然后呕吐。它似乎也会在接近迭代结束的调用上引发错误。此外,此错误发生在我的任何超时之前很久,在客户端和服务器端设置相同:
<binding name="WSHttpBinding_IMyService"
closeTimeout="00:10:00" openTimeout="00:10:00"
receiveTimeout="00:10:00" sendTimeout="00:10:00"... />
此外,我正在使用服务限制:
<serviceThrottling
maxConcurrentCalls="100"
maxConcurrentSessions="100" />
有任何想法吗?
谢谢,马克。