2010-09-06 161 views
1

我可以成功使用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; 

回答

2

這有什麼好做流。這是安全問題。您正在使用Windows安全性的Net TCP,其中服務必須向客戶端進行身份驗證,並且客戶端必須對該服務進行身份驗證。

您的案例中的服務認證基於用戶主體名稱。它是託管您服務的進程的用戶名。您必須修改客戶端配置並在端點中設置正確的標識。

喜歡的東西:

<client> 
    <endpoint name="..." addres="net.tcp://..." binding="netTcpBinding" bindingConfiguration="..." contract="..."> 
    <identity> 
     <userPrincipalName value="[email protected]" /> 
    </identity> 
    </endpoint> 
</client> 
+0

同意此無關與流。通過如上所述設置我的安全模式,並將SendTimeout從MaxValue更改爲20分鐘,呼叫就可以工作。 – 2010-09-20 07:35:09