如何修复 Web 服务上的“无法处理消息”错误

How to fix "The message could not be processed" error on web service

提问人:mhmtensyldrm 提问时间:11/10/2023 最后编辑:mhmtensyldrm 更新时间:11/14/2023 访问量:143

问:

Web 服务返回此错误,我尝试了几乎所有方法,但仍然无法修复它。我不知道问题是否与配置有关。

无法处理邮件。这很可能是因为操作“http://tempuri.org/IGazlarOrtak/EkstreSorgulama”不正确,或者消息包含无效或过期的安全上下文令牌,或者绑定之间不匹配。如果服务由于不活动而中止通道,则安全上下文令牌将无效。若要防止服务过早中止空闲会话,请增加服务终结点绑定的接收超时。

这是我的设置:

<wsHttpBinding>
        <binding name="wsHttpEndpoint" maxBufferPoolSize="2000000" maxReceivedMessageSize="2000000" receiveTimeout="00:10:00">
          <readerQuotas maxDepth="2000000" maxStringContentLength="2000000" maxArrayLength="2000000" maxBytesPerRead="2000000" maxNameTableCharCount="2000000"/>
          <security mode="TransportWithMessageCredential">
            <transport clientCredentialType="None" />
            <message clientCredentialType="UserName" />
          </security>
        </binding>
      </wsHttpBinding>
<endpoint address="https://webservice.halkbank.com.tr/EkstreWebServis.svc"
        binding="wsHttpBinding" bindingConfiguration="wsHttpEndpoint"
        contract="HalkbankWService.IGazlarOrtak" name="wsHttpEndpoint" />
.NET Web 服务 WCF

评论

0赞 QI You 11/13/2023
创建 WCF 项目后是否更改了接口名称?您可以尝试右键单击 svc 文件 -View MarkUp,然后修改 Service。
0赞 mhmtensyldrm 11/13/2023
@QIYou 不,我没有改变任何东西。
0赞 QI You 11/15/2023
我尝试寻找此问题的解决方案,通常可以添加超时来解决问题。添加代码:closeTimeout=“00:01:00” openTimeout=“00:01:00” receiveTimeout=“00:10:00” sendTimeout=“00:00:10”
0赞 mhmtensyldrm 11/15/2023
@QIYou我真的很感谢你的帮助,但仍然没有产生任何影响。
1赞 QI You 11/22/2023
我搜索了很多材料,访问了很多论坛,这个问题的通常解决方案是增加接收超时和安全上下文令牌。但是你尝试了,他们都没有解决问题,所以我们不得不专注于操作和配置。检查消息中的操作是否正确,以及是否与服务终结点的操作一致。检查客户端和服务器绑定是否匹配,以及它们是否使用相同的安全模型和传输协议。

答:

0赞 QI You 11/14/2023 #1

您可以在 Message 下添加 establishSecurityContext=“false”。这将禁用 SCT 协商,并直接使用每封邮件的凭据。

 <wsHttpBinding>
            <binding name="wsHttpEndpoint" maxBufferPoolSize="2000000" maxReceivedMessageSize="2000000" receiveTimeout="00:10:00">
              <readerQuotas maxDepth="2000000" maxStringContentLength="2000000" maxArrayLength="2000000" maxBytesPerRead="2000000" maxNameTableCharCount="2000000"/>
              <security mode="TransportWithMessageCredential">
                <transport clientCredentialType="None" />
                <message clientCredentialType="UserName" establishSecurityContext=“false” />
              </security>
            </binding>
          </wsHttpBinding>

评论

0赞 mhmtensyldrm 11/14/2023
我也试过了,但它没有解决问题..