.Net 4.0 WCF 与会员服务
遇到无法解释的问题..
将工作的 .Net 3.5 WCF 服务升级到 4.0 并立即遇到此错误:
“带有 Action 'http://schemas.xmlsoap.org/ws/2005/02/trust/RST 的消息由于 EndpointDispatcher 处的 ContractFilter 不匹配,/SCT' 无法在接收方处进行处理 这可能是由于合同不匹配(发送方和发送方之间的操作不匹配)。接收者)或发送者和接收者之间的绑定/安全不匹配。检查发送者和接收者是否具有相同的合同和相同的绑定(包括安全要求,例如消息、传输、无)。”
该服务正在使用wsHttpBinding 使用 TransportWithMessageCredential, Message ClientCredentials=UserName;因此它使用 SSL 来实现消息加密安全,并使用会员服务来进行用户身份验证。我们需要此配置,因为我们的业务合作伙伴将从公共互联网上访问此配置。 服务报告的绑定是:
<wsHttpBinding>
<binding name="WSHttpBinding_IManageSCACFI"
closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00"
sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false"
hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8"
useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="32"
maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="None"
proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName"
negotiateServiceCredential="true"
algorithmSuite="Default"
establishSecurityContext="false" />
</security>
</binding>
</wsHttpBinding>
这一切都在 Web 应用程序中运行(Windows Server 2008 上 IIS7 中的虚拟目录)。应用程序池已重置为使用 4.0 CLR。即使使用最简单的服务契约方法也会出现问题,该方法 写入
- 我知道 wcf 请求正在发送到服务器,因为我们使用的是自定义会员资格提供程序,并且我已将其连接起来以在验证凭据时写入日志条目,并且该日志条目正在被 。
- 我知道它不在代码中,因为整个包在具有完全相同的位和配置设置的开发盒(Windows 7,还有 IIS 7)上运行良好,
- 如果我切换到 Securitymode =“Transport”,它就可以工作 ,但当然它默认为 Windows 集成安全性,而不是 UserName (我不明白为什么要这样做,但确实如此,会员服务进程没有受到影响。)
- 我们已经完全重建了整个网站以及从头开始的 Web 应用程序服务器并且仍然遇到同样的问题。
- 上面的错误消息也是 WCF 诊断跟踪日志中报告的内容,并且没有更详细的信息来帮助解决。
一段时间以来,我们一直在努力解决这个问题,但没有成功。还有其他人遇到过这个问题吗?
having an unexplained issue..
Upgraded a working .Net 3.5 WCF service to 4.0 and immediately experienced this error:
"The message with Action 'http://schemas.xmlsoap.org/ws/2005/02/trust/RST/SCT' 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)."
The service is using wsHttpBinding using TransportWithMessageCredential, Message ClientCredentials=UserName; so it is using SSL for message encryption security and Membership services for user authentication. We need tthis configuration because our business partners will be accessing this from out on the public internet.
The binding reported by the service is :
<wsHttpBinding>
<binding name="WSHttpBinding_IManageSCACFI"
closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00"
sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false"
hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8"
useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="32"
maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="None"
proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName"
negotiateServiceCredential="true"
algorithmSuite="Default"
establishSecurityContext="false" />
</security>
</binding>
</wsHttpBinding>
This is all running in a web application (Virtual Directory in IIS7 on Windows Server 2008. The application pool has been reset to use the 4.0 CLR. The problem occurs even with the simplest service contract method, which simply returns a string.
- I know the wcf requests are making it to the server, because we are using a custom Membershiop provider, and I have wired it up to write a log entry when it validates the credentials, and this log entry is being created.
- I know it's not in the code cause the entire package works fine on the development box (Windows 7, but also IIS 7,) with the exact same bits and config settings.
- If I switch to Securitymode = "Transport", it works, but of course it is then defaulting to windows integrated security, instead of UserName (I don't understand why it is doing this, but it is, the membership services process is not getting hit.)
- We have completely rebuilt the entire web site and web application from scratch on the server and are still experiencing the same issue.
- The error message above is also what is reported in the WCF diagnostics trace log, and there is no more detailed information there to help with either.
We have been pounding away at this with no success for a while.. Has anyone else experienced this issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论