0

技術者 -- 常に人気のあるメッセージがあります。「受信メッセージの最大メッセージ サイズ クォータ (65536) を超えました。クォータを増やすには、適切なバインディングで MaxReceivedMessageSize プロパティを使用してください」。ここには新しいことは何もありません。メッセージが示すことだけを実行する必要があります。私の問題は、サービスの web.config ファイルでこれを設定する場所がわからないことです。

宣言型ワークフロー サービスを扱うのはこれが初めてなので、しばらくお待ちください。生成される web.config ファイルは、他のタイプの wcf サービス用に生成されるものよりも少し軽いようです。箱から出してすぐに使えるデフォルトは次のとおりです。

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<behaviors>
  <serviceBehaviors>
    <behavior>
      <serviceMetadata httpGetEnabled="true"/>
      <serviceDebug includeExceptionDetailInFaults="false"/>
    </behavior>
  </serviceBehaviors>
 </behaviors>
 <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
 </system.serviceModel>
 <system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>

このためのプロキシ クラスを生成するために svcutil.exe を実行すると、次のようなものが生成されました。

 <?xml version="1.0" encoding="utf-8"?>
 <configuration>
 <system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="BasicHttpBinding_TelaPointSMService" 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="8192" 
                 maxArrayLength="16384"
                 maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                <security mode="None">
                  <transport clientCredentialType="None" proxyCredentialType="None"
                        realm="" />
                   <message clientCredentialType="UserName" algorithmSuite="Default" />
                </security>
            </binding>
        </basicHttpBinding>
    </bindings>
    <client>
        <endpoint address="http://localhost:18781/TelaPointSMService.xamlx"
            binding="basicHttpBinding"
             bindingConfiguration="BasicHttpBinding_TelaPointSMService"
            contract="TelaPointSMService" name="BasicHttpBinding_TelaPointSMService" />
    </client>
   </system.serviceModel>
   </configuration>

では、ワークフロー サービスの web.config ファイルで、このサービスが既定の設定よりも大きなメッセージを確実に処理できるようにするには、何をどのように宣言すればよいでしょうか? クライアントバインディングでも設定を変更する必要があることは認識していますが、その変更をどこで行うかは明らかです。

4

1 に答える 1

1

4.0 を使用しているように見えるため、デフォルトのエンドポイントとバインディングにより、構成ファイルが軽くなります。これで問題になるのは、これまで見てきたように、既定のバインディングが既定の設定になっていることです。

これを解決するには、サービスの構成ファイルでデフォルトのバインディングを明示的に定義します。このバインディングは、そのバインディングを持つすべてのサービスに使用されます。これを行うには、通常どおりバインディングを定義しますが、属性を省略すると、次のnameようになります。

<system.serviceModel>     
  <bindings>         
    <basicHttpBinding>             
      <binding maxReceivedMessageSize="5242880" />
    </basicHttpBinding> 
  </bindings>
  <!-- The rest of your services config file -->
</system.serviceModel>

他の値も増やす必要があるかもしれません (おそらくバッファー サイズ) ので、同じ方法でそれらを追加しますmaxReceivedMessageSize。値 5242880 は私が過去に使用したものですが、より大きな値が必要になる場合があります (または、より小さな値が適切な場合があります)。

于 2012-07-27T19:42:44.973 に答える