9

これらのプロパティは、WCF Web API 構成に含まれていました。

            MaxBufferSize = int.MaxValue,
            MaxReceivedMessageSize = int.MaxValue,
4

4 に答える 4

17

自己ホストしている場合は、HttpSelfHostConfiguration クラスの一部です: HttpSelfHostConfiguration クラスの MSDN ドキュメント

次のように使用されます。

var config = new HttpSelfHostConfiguration(baseAddress);
config.MaxReceivedMessageSize = int.MaxValue;
config.MaxBufferSize = int.MaxValue;
于 2012-02-26T18:48:16.173 に答える
15

ASP.NETアプリケーションのweb.configのhttpRuntimeセクションを確認することをお勧めします。それらは完全に同じ名前ではありませんが、あなたがやろうとしていることに類似したものがあるかもしれません。例えば:

<configuration>
  <system.web>
    <httpRuntime maxRequestLength="16384" requestLengthDiskThreshold="16384"/>
  </system.web>
</configuration>

注:Int32.MaxValueは2,147,483,647です。

于 2012-03-01T19:24:18.447 に答える
4

最初に、WCF App.config でこの構成を行います。

<endpoint address ="" binding="basicHttpBinding" bindingConfiguration="basicHttp" contract="AddSubService.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>

<bindings>
  <basicHttpBinding>
    <binding name="basicHttp" allowCookies="true"
             maxReceivedMessageSize="20000000"
             maxBufferSize="20000000"
             maxBufferPoolSize="20000000">
      <readerQuotas maxDepth="32"
           maxArrayLength="200000000"
           maxStringContentLength="200000000"/>
    </binding>
  </basicHttpBinding>
</bindings>

次に、web.config で WCF を呼び出している ASP.NET 側で参照を更新してみて、エンドポイントが同じに変更されていることを確認します。

于 2012-03-07T09:23:29.633 に答える