最近、バインド構成を変更して、WCF サービスでの偽装を許可しました。これを実装することで、ストリーミングではなくバッファリングされた TransferMode.Buffered を使用する必要がありました。これでしばらくは問題が解決したように見えましたが、メッセージで渡すために MemoryStream を割り当てようとすると、大きなファイル (>200MB) が例外をスローすることに気付きました。私の同僚とグーグルは、チャンキングが答えであると私に信じさせ、それ以来、このサンプルのバージョンを実装しようとしました:
Binding ではなく BasicHttpBinding から派生するように TCPChunkingBinding クラスを変更し、チャンクを試す前に使用した必要な BasicHttpSecurity 属性を追加しました。
以前に BasicHttpBinding を使用していたすべてのエンドポイントが、TCPChunkingBinding を使用するようになりました。TCPChunkingBinding クラスに加えた変更は次のとおりです。
TcpChunkingBinding : BasicHttpBinding, IBindingRuntimePreferences
...
void Initialize()
{
be = new ChunkingBindingElement();
tcpbe = new TcpTransportBindingElement();
tcpbe.TransferMode = TransferMode.Buffered; //no transport streaming
tcpbe.MaxReceivedMessageSize = ChunkingUtils.ChunkSize + 100 * 1024; //add 100KB for headers
this.MessageEncoding = WSMessageEncoding.Mtom;
this.SendTimeout = new TimeSpan(0, 5, 0);
this.ReceiveTimeout = this.SendTimeout;
this.TransferMode = TransferMode.Buffered;
BasicHttpSecurity security = new BasicHttpSecurity();
security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;
security.Transport.ClientCredentialType = HttpClientCredentialType.Windows;
security.Transport.ProxyCredentialType = HttpProxyCredentialType.None;
security.Transport.Realm = string.Empty;
security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;
security.Message.AlgorithmSuite = System.ServiceModel.Security.SecurityAlgorithmSuite.Default;
this.Security = security;
私が得るエラーは
The contract operation 'DownloadStream' requires Windows identity for automatic impersonation. A Windows identity that represents the caller is not provided by binding ('TcpChunkingBinding','http://tempuri.org/') for contract ('ITestService','http://tempuri.org/'.
サンプルの Service クラスの Host.cs で host.open() を呼び出すと。
基本的に私の質問は、誰かがこのサンプルを偽装とチャンクで動作させる方法を理解するのを手伝ってもらえますか?
誰かが答える前に、チャンキング ロードを試す前に、すべてのバッファ設定を最大にしました。なりすましが必要なため、ストリーミング転送モードを使用できません。前もって感謝します。