【问题标题】:Streaming over WCF using NetTcpBinding使用 NetTcpBinding 通过 WCF 流式传输
【发布时间】:2010-09-06 09:29:00
【问题描述】:

我可以成功地使用 WCF 流将数据从服务器传输到同一台计算机上的客户端。但是,一旦我将服务器部署到另一台机器上,就会出现“对 SSPI 的调用失败:目标主体名称不正确”性质的错误。有没有人遇到过这个。我试图在两边都设置 SecurotyMode.None 但这给了我一些其他超时错误!

这是服务器绑定:

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;

【问题讨论】:

    标签: .net wcf tcp


    【解决方案1】:

    这与流媒体无关。这是安全问题。您正在使用具有 Windows 安全性的 Net TCP,其中服务必须对客户端进行身份验证,而客户端必须对服务进行身份验证。

    在您的情况下,服务身份验证基于用户主体名称。它是托管您的服务的进程的用户名。您必须修改客户端配置并在端点中设置正确的身份。

    类似:

    <client>
      <endpoint name="..." addres="net.tcp://..." binding="netTcpBinding" bindingConfiguration="..." contract="...">
        <identity>
          <userPrincipalName value="MyServiceAccount@MyDomain" />
        </identity>
      </endpoint>
    </client> 
    

    【讨论】:

    • 同意这与流媒体无关。如上所述设置我的安全模式并将 SendTimeout 从 MaxValue 更改为 20 分钟后,调用成功了。
    猜你喜欢
    • 2012-08-01
    • 1970-01-01
    • 2013-04-27
    • 1970-01-01
    • 2011-11-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-11-30
    相关资源
    最近更新 更多