2017-09-12 16 views
3

私はWCFサービスを使用しています。私が持っている問題は、ダブルメモリを使用した起動です。WCFメモリが劇的に増加します

私は

<wsHttpBinding> 
     <binding name="secureHttpBinding" closeTimeout="04:01:00" openTimeout="04:01:00" receiveTimeout="04:10:00" sendTimeout="04:01:00" allowCookies="false" 
       bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" 
        messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"> 
      <readerQuotas maxDepth="128" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/> 
      <security mode="Transport" > 
      <transport clientCredentialType="None"/> 
      </security> 
     </binding> 
     </wsHttpBinding> 

<endpoint address="https://localhost/test.svc" 
       binding="wsHttpBinding" 
       bindingConfiguration="secureHttpBinding" 
       contract="IWcfContract" 
       name="SecureBasicHttpBinding_WcfContract"> 

を結合すると、ここで私はここで

using (Stream fileStream = File.OpenRead(logsZipFullPath)) 
{ 
    // Call web server 
    UploadFileResponse response = _webServiceHelper.UploadFile(fileStream, currentDate, ".zip", string.Empty); 
    fileStream.Close(); 
} 

をアップロードするために使用していたコードは、私のモデルは私のzipファイルがである

[MessageContract] 
    public class UploadFileRequest : IDisposable 
    { 
     [MessageBodyMember(Order = 1)] 
     public Stream FileByteStream; 
     [MessageHeader(MustUnderstand = true)] 
     public string FileDescription; 

    } 

ですHTTPSを使用しています80MB。

私が持っている問題は、サービスの開始時に使用しています26mbこれはかなり良いです。最初のコールでは、136MBが使用され、コールが完了すると、26mbになります。それはまた大丈夫です。アップロードの2回目の呼び出しの後、346MB を使用して開始します。サービスコール後に再び26mbになります。私の質問は、ファイルが唯一の80MBのときに346MBを使用している理由です。 GCとdisponseが正しく呼び出されました。しかし、これは正常な動作ですか、何かが欠けていますか?

答えて

0

最終的にこれを回避する方法が見つかりました。 wsHttpBindingが 機能や規格* WS-のトンをサポートしており、本格的な結合であるthis post

によると - それは、より多くのセキュリティ機能をたくさん持っている、あなたは sessionful接続を使用することができます、あなたは信頼性の高いメッセージングを使用することができ、あなたは 使用トランザクション制御することができます - ちょうどより多くのものが、 をwsHttpBinding *も重いたくさんある」と

が、私はこれがあると思い、彼らがネットワーク上を移動 としてあなたのメッセージに多くのオーバーヘッドを追加しますメモリ使用量が高い主な理由。 HTTPS証明書を使用する必要があり、basicHttpBindingでこれを使用できます。だから、私はこの

<basicHttpBinding> 
     <binding name="BasicHttpBinding_WcfContract" closeTimeout="04:01:00" openTimeout="04:01:00" receiveTimeout="04:10:00" sendTimeout="04:01:00" allowCookies="false" 
       bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" 
       maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" transferMode="Streamed" useDefaultWebProxy="true"> 
      <readerQuotas maxDepth="128" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/> 
      <security mode="Transport"> <-- this is the main change 
      <transport clientCredentialType="None" proxyCredentialType="None" realm=""/> 
      <message clientCredentialType="UserName" algorithmSuite="Default"/> 
      </security> 
     </binding> 
     </basicHttpBinding> 

ノートのように私の設定を変更する:私はセキュリティモードなし輸送へのHTTPSをサポートするように変更しました。

今、問題なく動作します。 メモリの問題を引き起こす可能性のある2つの事柄。

  1. wsHttpBindingオーバーヘッド
  2. ストリームモードがwsHttpBinding
ではサポートされていません。
関連する問題