使用NetTcpBinding通过WCF流式传输
问题描述:
我可以成功使用WCF流式传输将xfer数据从服务器传输到同一台计算机上的客户端。但是,只要我将服务器部署到另一台计算机上,就会发生性质错误“调用SSPI失败:目标主体名称不正确”。有没有人遇到过这个。我试图在两侧设置SecurotyMode.None,但那给了我一些其他超时错误!使用NetTcpBinding通过WCF流式传输
这里是服务器绑定:
NetTcpBinding binding = new NetTcpBinding();
binding.TransferMode = TransferMode.Streamed;
binding.MaxReceivedMessageSize = int.MaxValue;
binding.CloseTimeout = TimeSpan.MaxValue;
binding.SendTimeout = TimeSpan.MaxValue;
var ep = serviceHost.AddServiceEndpoint(typeof(ISessionResultsServer), binding, string.Format("net.tcp://localhost:{0}/ResultService", port));
下面是客户端绑定:
NetTcpBinding clientBinding = new NetTcpBinding();
clientBinding.TransferMode = TransferMode.Streamed;
clientBinding.SendTimeout = TimeSpan.MaxValue;
clientBinding.CloseTimeout = TimeSpan.MaxValue;
clientBinding.MaxReceivedMessageSize = long.MaxValue;
clientBinding.ReceiveTimeout = TimeSpan.MaxValue;
答
这有什么好做流。这是安全问题。您正在使用Windows安全性的Net TCP,其中服务必须向客户端进行身份验证,并且客户端必须对该服务进行身份验证。
您的案例中的服务认证基于用户主体名称。它是托管您服务的进程的用户名。您必须修改客户端配置并在端点中设置正确的标识。
喜欢的东西:
<client>
<endpoint name="..." addres="net.tcp://..." binding="netTcpBinding" bindingConfiguration="..." contract="...">
<identity>
<userPrincipalName value="[email protected]" />
</identity>
</endpoint>
</client>
同意此无关与流。通过如上所述设置我的安全模式,并将SendTimeout从MaxValue更改为20分钟,呼叫就可以工作。 – 2010-09-20 07:35:09