gpt4 book ai didi

TCP 的 WCF 错误

转载 作者:可可西里 更新时间:2023-11-01 02:42:57 26 4
gpt4 key购买 nike

我有一个网站连接到部署在 IIS 中的 WCF 服务,该服务位于负载平衡器和防火墙后面的两个应用程序服务器上。当我使用 HTTP 端点时,网站能够成功连接到 WCF 服务。但是在切换到 TCP 协议(protocol)时,我看到以下错误。

需要更多数据,但已达到 EOF。

[InvalidDataException:需要更多数据,但已达到 EOF。]

[ProtocolException:在流的位置 0 处读取消息帧格式时出错(状态:ReadingUpgradeRecord)]

[ProtocolException:位于 net.tcp:///SecurityService.svc 的服务器拒绝了 session 建立请求。]

网站应用程序池在本地用户帐户下运行,而 WCF 服务在默认的 ApplicationPoolIdentity 下运行。服务端未生成任何跟踪日志。跟踪日志在客户端生成并出现相同的错误。

WCF 服务托管在应用程序服务器的默认端口 808 下,但不与任何其他应用程序/服务共享。环境:Win2k8、IIS 7.5

我已经验证了从 Web 服务器到应用程序服务器的 TCP 连接,没有问题。

如果我需要任何其他信息,请告诉我。非常感谢任何指导,因为我在这方面花了很多时间。

配置文件的片段如下:

WCF 服务

<bindings>
<netTcpBinding>
<binding name="NetTcpBinding_Configuration" closeTimeout="00:10:00"
openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
hostNameComparisonMode="StrongWildcard" listenBacklog="10" maxBufferPoolSize="524288"
maxBufferSize="2147483647" maxConnections="100" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="None"/>
</binding>
</netTcpBinding>
</bindings>
<services>
<service name="<namespace>.ServiceImplementation.Security">
<endpoint address="net.tcp://<servername>/SecurityService.svc"
binding="netTcpBinding" bindingConfiguration="NetTcpBinding_Configuration"
contract="<namespace>.ServiceInterface.ServiceContracts.ISecurity" name="NetTcpBinding_Security">
<identity>
<servicePrincipalName value="host/<servername>" />
</identity>
</endpoint>
</service>
</services>

网站客户端

<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_Configuration" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
<netTcpBinding>
<binding name="NetTcpBinding_Configuration" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" listenBacklog="10" maxBufferPoolSize="524288" maxBufferSize="2147483647" maxConnections="10" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
<security mode="None" />
</binding>
</netTcpBinding>
</bindings>
<client>
<endpoint address="http://<servername>/SecurityService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_Configuration" contract="SecurityService.Security" name="BasicHttpBinding_Security" />
<endpoint address="net.tcp://<servername>/SecurityService.svc" binding="netTcpBinding" bindingConfiguration="NetTcpBinding_Configuration" contract="SecurityService.Security" name="NetTcpBinding_Security">
<identity>
<servicePrincipalName value="host/<servername>" />
</identity>
</endpoint>
</client>

最佳答案

如果我是你,我会Wireshark从客户端到服务器的流量。您只想确保您的流量不会在途中的某个地方被阻塞。如果您可以确认不是这种情况,则一定是 WCF 服务配置问题。

在尝试调试 WCF 配置之前,请尝试从图片中删除负载均衡器(如果可以),然后直接访问 WCF 服务。大多数负载均衡器默认支持 HTTP;但需要为任何其他协议(protocol)进行特殊配置。

关于TCP 的 WCF 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14873584/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com