1

以下はサーバー側のWeb.Configで説明されています。

<bindings>
    <wsHttpBinding>
        <binding name="NewBinding0" closeTimeout="00:50:00" openTimeout="00:50:00" sendTimeout="00:50:00" receiveTimeout="00:50:00" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647">
            <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
            <reliableSession enabled="true" />
            <security mode="None">
                <transport clientCredentialType="None" />
                <message clientCredentialType="Windows" negotiateServiceCredential="true" establishSecurityContext="false" />
            </security>
        </binding>
    </wsHttpBinding>
</bindings>

また、クライアント側では、以下の設定について説明します。

WSHttpBinding binding = new WSHttpBinding();
//binding.ReaderQuotas.MaxArrayLength = 10485760;
//binding.MaxReceivedMessageSize = 10485760;
binding.Security.Mode = SecurityMode.None;
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;
binding.Security.Message.ClientCredentialType = MessageCredentialType.Windows;
binding.Security.Message.EstablishSecurityContext = false;
//binding.Security.Message.NegotiateServiceCredential = true;
binding.ReliableSession.Enabled = true;
binding.ReaderQuotas.MaxArrayLength = 2147483647;
binding.ReaderQuotas.MaxDepth = 2147483647;
binding.ReaderQuotas.MaxNameTableCharCount = 2147483647;
binding.ReaderQuotas.MaxBytesPerRead = 2147483647;
//binding.MaxReceivedMessageSize = 20000000;2147483647
binding.MaxReceivedMessageSize = 2147483647;
//binding.MaxReceivedMessageSize = Int32.MaxValue;
binding.ReaderQuotas.MaxStringContentLength = 2147483647;
//binding.MaxBufferPoolSize = 20000000;
binding.MaxBufferPoolSize = 2147483647;
//binding.MaxBufferPoolSize = Int32.MaxValue;
binding.ReaderQuotas.MaxArrayLength = 2147483647;
binding.ReaderQuotas.MaxDepth = 2147483647;
binding.SendTimeout = TimeSpan.FromMinutes(50);
binding.CloseTimeout = TimeSpan.FromMinutes(50);
binding.OpenTimeout = TimeSpan.FromMinutes(50);
binding.ReceiveTimeout = TimeSpan.FromMinutes(50);

//EndpointIdentity.CreateUpnIdentity("user@domain");
ChannelFactory<IDBSyncContract> factory = new ChannelFactory<IDBSyncContract>(binding, new EndpointAddress(endPointURL));
dbProxy = factory.CreateChannel();
this.dbProxy = dbProxy as IDBSyncContract;

上記のエラーが発生します。

wsHttpBindingsに関する懸念はありますか。

4

1 に答える 1

2

問題は、サービスがホスト マシンで使用可能なすべてのメモリを消費していることです。構成の変更をすべて削除し、構成を WCF の既定値に戻すことをお勧めします。これらの既定値は、平均的な WCF サービスで最高のパフォーマンスを得るために Microsoft によって選択されたものであり、変更する必要があることが実証されている場合にのみ変更する必要があります。

デフォルト値の唯一の例外として、maxReceivedMessageSizeと のmaxBufferSize値をお勧めします。私なら 262,144 バイトから始めます。これらの設定のいずれかで特定の例外が発生した場合は、影響を受ける設定のみを変更します。

設定を max integer に上げても問題が解決しない場合は、通常の構成設定内で呼び出しが成功するようにサービス設計を変更することを検討してください。WCF の既定値にできる限り近づけることで、サービスの全体的なパフォーマンスが最高になります。

于 2012-10-25T13:57:53.370 に答える