0

エラーが発生します

文字列コンテンツの最大長クォータ(8192)を超えました

WCF構成を変更する必要があることはわかっていますが、機能させることができません。これまでのところ、組み込みのWCFエディターを使用しようとしました。

    <system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding>
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
            maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
        </binding>
      </wsHttpBinding>
    </bindings>

    <client>
      <remove contract="IMetadataExchange" name="sb" />
      <endpoint address="" binding="netTcpRelayBinding" contract="IMetadataExchange"
        name="sb" />
    </client>
    <services>
      <service name="SvcLibrary.Service1">
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8732/Design_Time_Addresses/SvcLibrary/Service1/"/>
          </baseAddresses>
        </host>
        <!-- Service Endpoints -->
        <!-- Unless fully qualified, address is relative to base address supplied above -->
        <endpoint address="" binding="wsHttpBinding" contract="SvcLibrary.IService1">
          <!-- 
              Upon deployment, the following identity element should be removed or replaced to reflect the 
              identity under which the deployed service runs.  If removed, WCF will infer an appropriate identity 
              automatically.
          -->
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
        <!-- Metadata Endpoints -->
        <!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. -->
        <!-- This endpoint does not use a secure binding and should be secured or removed before deployment -->
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, 
          set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="True"/>
          <!-- To receive exception details in faults for debugging purposes, 
          set the value below to true.  Set to false before deployment 
          to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="False"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
4

3 に答える 3

2

SCBは、バインディングに関して正しいです。

<bindings>
      <wsHttpBinding>
        <binding>
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
            maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
        </binding>
      </wsHttpBinding>
    </bindings>

しかし、クライアントアプリを次のように変更する必要があるため、「最大文字列コンテンツ長のクォータ(8192)を超えました」というエラーも発生していました。

 <basicHttpBinding>
        <binding name="BasicHttpBinding_IXRMService" closeTimeout="00:01:00"
          openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
          allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
          maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
          messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
          useDefaultWebProxy="true">
          <readerQuotas maxDepth="32" maxStringContentLength="65536" maxArrayLength="16384"
            maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None"
              realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
      </basicHttpBinding>

デフォルトのmaxStringContentLengthは8192 に設定されていましたが、65536に増やしたところ、問題は解決しました。

于 2012-09-19T05:18:08.617 に答える
1

バインディングセクションを次のように変更する必要があります。

<bindings>
      <wsHttpBinding>
        <binding maxReceivedMessageSize="2147483647">
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
            maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
        </binding>
      </wsHttpBinding>
    </bindings>

エンドポイントは、wsHttpBindingを使用していることを指定していますが、basicHttpBindingのみを構成しています。

これは、サービスがデフォルトのみを使用することを意味します

ちなみに、指定した値は膨大なので、確認することをお勧めします

- アップデート

バインディングにmaxReceivedMessageSize属性を追加しました。

また、クライアント側で変更を加えたかどうかを確認できますか。基本的に、クライアントとサーバーの両方の構成が一致している必要があります。

于 2012-09-19T04:38:47.453 に答える
0

正しいプロパティ(maxStringContentLength)を設定していますが、バインディングが間違っています。問題は、サービスエンドポイントの構成を定義しているが、basicHttpBindingそれを使用していることです。wsHttpBindingバインディング構成をに変更するwsHttpBindingと、正常に機能するはずです(WS- *機能が必要かどうかを確認する必要がある場合wsHttpBindingがあります。また、エンドポイントのバインディングをに変更することもできます。basicHttpBindingサポートが必要ない限り、これも機能します。分散トランザクションなど)

于 2012-09-19T04:38:56.070 に答える