WCF错误:无法在接收方处理带有Action的消息

时间:2011-04-19 09:34:20

标签: asp.net wcf wcf-binding wcf-security wcf-client

我在Web应用程序中遇到了一个着名的错误,即WCF客户端:

  

带有Action的消息不能   由于a,在接收器处理   ContractFilter不匹配   EndpointDispatcher。这可能是   因为合同不匹配   (发件人和发件人之间不匹配的行为)   接收者)或绑定/安全   发件人和发件人之间不匹配   接收器。检查发件人和   接收者有相同的合同和   相同的绑定(包括安全性   要求,例如消息,运输,   无)。

有几个有趣的事实:
- 它有时会发生并且对某些用户而言。它是来自Web应用程序的跟踪的一部分(user1获取错误,而user2工作正常):

19/04/2011 9:43:37|52ms2ebf25dj1x2ldk0gci55/user1|OperationQueueTasksStart|TaskCount:1|InvestigationId:f855786f-f06c-4b63-bd38-e1f414c0270b
19/04/2011 9:43:38|52ms2ebf25dj1x2ldk0gci55/user1|OperationQueueTasksStop|Elapsed:0.0045741|WithResult:True|InvestigationId:f855786f-f06c-4b63-bd38-e1f414c0270b
19/04/2011 9:43:38|52ms2ebf25dj1x2ldk0gci55/user1|AllocationEnd|Elapsed:0.2748583
19/04/2011 9:43:38|52ms2ebf25dj1x2ldk0gci55/user1|AllocationErrorTrace|Errors were encountered:- The message with Action 'http://tempuri.org/IAllocationProvider/OperationQueueTasks2' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver.  Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).
19/04/2011 9:43:47|o52wurr3kkx0pkj024dhjj55/user2|OperationQueueTasksStop|Elapsed:9.4693646|WithResult:False|InvestigationId:376f17e8-e969-4394-a6fc-2538632d2956
19/04/2011 9:43:47|o52wurr3kkx0pkj024dhjj55/user2|OperationQueueTasksStart|TaskCount:5|InvestigationId:1083fe62-f31d-48b6-9f6b-d0a28a62912e
19/04/2011 9:43:53|o52wurr3kkx0pkj024dhjj55/user2|OperationQueueTasksStop|Elapsed:6.0867429|WithResult:False|InvestigationId:1083fe62-f31d-48b6-9f6b-d0a28a62912e
19/04/2011 9:43:53|o52wurr3kkx0pkj024dhjj55/user2|OperationQueueTasksStart|TaskCount:1|InvestigationId:159ccda4-f753-40f0-a0a7-e531e6826d67
19/04/2011 9:43:57|o52wurr3kkx0pkj024dhjj55/user2|OperationQueueTasksStop|Elapsed:3.9732669|WithResult:False|InvestigationId:159ccda4-f753-40f0-a0a7-e531e6826d67
19/04/2011 9:43:57|o52wurr3kkx0pkj024dhjj55/user2|OperationQueueTasksStart|TaskCount:1|InvestigationId:73493ade-c9cc-42e1-8be5-0869070c8542
19/04/2011 9:43:59|o52wurr3kkx0pkj024dhjj55/user2|OperationQueueTasksStop|Elapsed:2.4491641|WithResult:False|InvestigationId:73493ade-c9cc-42e1-8be5-0869070c8542
19/04/2011 9:43:59|o52wurr3kkx0pkj024dhjj55/user2|OperationQueueTasksStart|TaskCount:2|InvestigationId:60c0f224-558f-4f0b-977a-9c15e101a6a9
19/04/2011 9:44:03|o52wurr3kkx0pkj024dhjj55/user2|OperationQueueTasksStop|Elapsed:3.1119381|WithResult:False|InvestigationId:60c0f224-558f-4f0b-977a-9c15e101a6a9
19/04/2011 9:44:03|o52wurr3kkx0pkj024dhjj55/user2|OperationQueueTasksStart|TaskCount:2|InvestigationId:677fa342-ff38-49ae-bed1-3d2f8b843b17
19/04/2011 9:44:07|o52wurr3kkx0pkj024dhjj55/user2|OperationQueueTasksStop|Elapsed:4.7489463|WithResult:False|InvestigationId:677fa342-ff38-49ae-bed1-3d2f8b843b17
19/04/2011 9:44:07|o52wurr3kkx0pkj024dhjj55/user2|OperationQueueTasksStart|TaskCount:4|InvestigationId:c4cd34d6-3564-4a06-bc0b-f25fc37d86de
19/04/2011 9:44:12|o52wurr3kkx0pkj024dhjj55/user2|OperationQueueTasksStop|Elapsed:4.41472|WithResult:False|InvestigationId:c4cd34d6-3564-4a06-bc0b-f25fc37d86de
19/04/2011 9:44:12|o52wurr3kkx0pkj024dhjj55/user2|OperationQueueTasksStart|TaskCount:3|InvestigationId:b4e0a795-d4ba-42b8-8d21-3ffa2aa2a7fc
19/04/2011 9:44:16|o52wurr3kkx0pkj024dhjj55/user2|OperationQueueTasksStop|Elapsed:4.0598829|WithResult:False|InvestigationId:b4e0a795-d4ba-42b8-8d21-3ffa2aa2a7fc
19/04/2011 9:44:16|o52wurr3kkx0pkj024dhjj55/user2|AllocationEnd|Elapsed:88.0465741
19/04/2011 9:44:47|52ms2ebf25dj1x2ldk0gci55/user1|AllocationStart|InvestigationCount:1|QueueId:98aebaa3-f507-4f3d-b919-1a95a5b1d2ea
19/04/2011 9:44:47|52ms2ebf25dj1x2ldk0gci55/user1|OperationQueueTasksStart|TaskCount:1|InvestigationId:f855786f-f06c-4b63-bd38-e1f414c0270b
19/04/2011 9:44:48|52ms2ebf25dj1x2ldk0gci55/user1|OperationQueueTasksStop|Elapsed:0.0043857|WithResult:True|InvestigationId:f855786f-f06c-4b63-bd38-e1f414c0270b
19/04/2011 9:44:48|52ms2ebf25dj1x2ldk0gci55/user1|AllocationEnd|Elapsed:0.3354014
19/04/2011 9:44:48|52ms2ebf25dj1x2ldk0gci55/user1|AllocationErrorTrace|Errors were encountered:- The message with Action 'http://tempuri.org/IAllocationProvider/OperationQueueTasks2' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver.  Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).
19/04/2011 9:51:27|o52wurr3kkx0pkj024dhjj55/user2|AllocationStart|InvestigationCount:14|QueueId:98aebaa3-f507-4f3d-b919-1a95a5b1d2ea
19/04/2011 9:51:27|o52wurr3kkx0pkj024dhjj55/user2|OperationQueueTasksStart|TaskCount:1|InvestigationId:a0c00957-c621-4f7a-a65d-1fa873b24afc
19/04/2011 9:51:29|o52wurr3kkx0pkj024dhjj55/user2|OperationQueueTasksStop|Elapsed:2.6407058|WithResult:False|InvestigationId:a0c00957-c621-4f7a-a65d-1fa873b24afc
19/04/2011 9:51:29|o52wurr3kkx0pkj024dhjj55/user2|OperationQueueTasksStart|TaskCount:1|InvestigationId:29989dfb-1f4a-4524-ac50-68cce1b373b0
19/04/2011 9:51:32|o52wurr3kkx0pkj024dhjj55/user2|OperationQueueTasksStop|Elapsed:2.3559612|WithResult:False|InvestigationId:29989dfb-1f4a-4524-ac50-68cce1b373b0
19/04/2011 9:51:32|o52wurr3kkx0pkj024dhjj55/user2|OperationQueueTasksStart|TaskCount:1|InvestigationId:f8978117-40b3-497e-baec-09ed0508e6d9
19/04/2011 9:51:34|o52wurr3kkx0pkj024dhjj55/user2|OperationQueueTasksStop|Elapsed:2.736648|WithResult:False|InvestigationId:f8978117-40b3-497e-baec-09ed0508e6d9
19/04/2011 9:51:34|o52wurr3kkx0pkj024dhjj55/user2|OperationQueueTasksStart|TaskCount:1|InvestigationId:aea25d48-48eb-4bc8-9347-b7d79267330e
19/04/2011 9:51:37|o52wurr3kkx0pkj024dhjj55/user2|OperationQueueTasksStop|Elapsed:2.3584367|WithResult:False|InvestigationId:aea25d48-48eb-4bc8-9347-b7d79267330e
19/04/2011 9:51:37|o52wurr3kkx0pkj024dhjj55/user2|OperationQueueTasksStart|TaskCount:1|InvestigationId:f983cc74-5e4e-438a-8083-dca3ab116d03
19/04/2011 9:51:39|o52wurr3kkx0pkj024dhjj55/user2|OperationQueueTasksStop|Elapsed:2.3643481|WithResult:False|InvestigationId:f983cc74-5e4e-438a-8083-dca3ab116d03
19/04/2011 9:51:39|o52wurr3kkx0pkj024dhjj55/user2|OperationQueueTasksStart|TaskCount:1|InvestigationId:4fc1febb-3495-46bc-b3df-814c88e2164c
19/04/2011 9:51:41|o52wurr3kkx0pkj024dhjj55/user2|OperationQueueTasksStop|Elapsed:2.4341061|WithResult:False|InvestigationId:4fc1febb-3495-46bc-b3df-814c88e2164c
19/04/2011 9:51:41|o52wurr3kkx0pkj024dhjj55/user2|OperationQueueTasksStart|TaskCount:1|InvestigationId:a7adf45e-2476-4478-b579-2eb58cb1b90e
19/04/2011 9:51:44|o52wurr3kkx0pkj024dhjj55/user2|OperationQueueTasksStop|Elapsed:2.7966921|WithResult:False|InvestigationId:a7adf45e-2476-4478-b579-2eb58cb1b90e
19/04/2011 9:51:44|o52wurr3kkx0pkj024dhjj55/user2|OperationQueueTasksStart|TaskCount:1|InvestigationId:937ee46d-61ed-477f-91df-876dc011b488
19/04/2011 9:51:47|o52wurr3kkx0pkj024dhjj55/user2|OperationQueueTasksStop|Elapsed:2.3558742|WithResult:False|InvestigationId:937ee46d-61ed-477f-91df-876dc011b488
19/04/2011 9:51:47|o52wurr3kkx0pkj024dhjj55/user2|OperationQueueTasksStart|TaskCount:1|InvestigationId:4f6c23d5-3082-4578-bc25-e1acaea3b944
19/04/2011 9:51:49|o52wurr3kkx0pkj024dhjj55/user2|OperationQueueTasksStop|Elapsed:2.216947|WithResult:False|InvestigationId:4f6c23d5-3082-4578-bc25-e1acaea3b944
19/04/2011 9:51:49|o52wurr3kkx0pkj024dhjj55/user2|OperationQueueTasksStart|TaskCount:1|InvestigationId:e4c4517e-f522-490a-9e5d-4244cf51efe0
19/04/2011 9:51:51|o52wurr3kkx0pkj024dhjj55/user2|OperationQueueTasksStop|Elapsed:2.5495532|WithResult:False|InvestigationId:e4c4517e-f522-490a-9e5d-4244cf51efe0
19/04/2011 9:51:51|o52wurr3kkx0pkj024dhjj55/user2|OperationQueueTasksStart|TaskCount:1|InvestigationId:8b7ecc3a-f234-45e7-8824-e39f0209d00b
19/04/2011 9:51:54|o52wurr3kkx0pkj024dhjj55/user2|OperationQueueTasksStop|Elapsed:2.4506334|WithResult:False|InvestigationId:8b7ecc3a-f234-45e7-8824-e39f0209d00b
19/04/2011 9:51:54|o52wurr3kkx0pkj024dhjj55/user2|OperationQueueTasksStart|TaskCount:1|InvestigationId:abac0e79-587d-407d-bdb6-63c6af3f4217
19/04/2011 9:51:56|o52wurr3kkx0pkj024dhjj55/user2|OperationQueueTasksStop|Elapsed:2.2250336|WithResult:False|InvestigationId:abac0e79-587d-407d-bdb6-63c6af3f4217
19/04/2011 9:51:56|o52wurr3kkx0pkj024dhjj55/user2|OperationQueueTasksStart|TaskCount:1|InvestigationId:0e11aea4-7cc8-4225-8ba1-c68487e38ad2
19/04/2011 9:52:00|o52wurr3kkx0pkj024dhjj55/user2|OperationQueueTasksStop|Elapsed:3.9445225|WithResult:False|InvestigationId:0e11aea4-7cc8-4225-8ba1-c68487e38ad2
19/04/2011 9:52:00|o52wurr3kkx0pkj024dhjj55/user2|OperationQueueTasksStart|TaskCount:1|InvestigationId:9c6557ed-843c-44d6-a6b0-bd2a702efcaf
19/04/2011 9:52:03|o52wurr3kkx0pkj024dhjj55/user2|OperationQueueTasksStop|Elapsed:2.6812607|WithResult:False|InvestigationId:9c6557ed-843c-44d6-a6b0-bd2a702efcaf
19/04/2011 9:52:03|o52wurr3kkx0pkj024dhjj55/user2|AllocationEnd|Elapsed:36.1138801
  • 还有一种模式(我不知道多么可靠)某些特定用户(就asp .net会话而言)更频繁地(如果不是所有时间)获得该错误。另一方面,我的用户根本没有遇到过这个错误。

任何可能导致这种神秘行为的想法?

谢谢,帕维尔

编辑1:添加配置信息

<endpoint address="net.tcp://10.80.12.25:8400/Hire.Application.Services/AllocationService" behaviorConfiguration="endpointBehavior" binding="netTcpBinding" bindingConfiguration="netTcpBinding" contract="Hire.Application.Contracts.IAllocationProvider" name="AllocationProvider" />

<endpointBehaviors>
    <behavior name="endpointBehavior">
        <customBehavior />
    </behavior>
</endpointBehaviors>

<extensions>
    <behaviorExtensions>
        <add name="customBehavior" type="Hire.Application.Contracts.CustomBehaviorExtensionElement, Hire.Application.Contracts, Version=5.2.7.0, Culture=neutral, PublicKeyToken=null" />
    </behaviorExtensions>
</extensions>

<bindings>
    <netTcpBinding>
        <binding name="netTcpBinding" closeTimeout="00:05:00" openTimeout="00:05:00" sendTimeout="00:05:00" receiveTimeout="00:15:00" hostNameComparisonMode="StrongWildcard" maxBufferSize="6553600" maxBufferPoolSize="524288" maxReceivedMessageSize="6553600">
            <readerQuotas maxDepth="64" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
            <security mode="None" />
        </binding>
    </netTcpBinding>
</bindings>

编辑2:netTcpBinding使用默认配置(会话已启用,服务上未设置任何SessionMode属性。会话超时也使用默认值.InstanceContextMode也设置为默认PerSession值。

1 个答案:

答案 0 :(得分:3)

问题已解决。事实证明,Web服务器(WCF客户端)在发出请求时使用类似循环法的四个应用程序服务器(节点)连接。由于某种原因,一个节点有旧的服务合同汇编与旧的操作合同旧方法签名(谢谢Reflector!)。

谢谢,帕维尔