36

WCFサービスに送信される大量のデータを受け入れることができないようです。

クライアント用にmaxReceivedMessageSizeを構成しましたが、大きなデータを問題なく受信できましたが、それは問題ではありません。サービスにデータを送信しています。

サービスを設定しようとしましたが、うまくいきませんでした。これが私のweb.configです。

<?xml version="1.0"?>
<configuration>
  <system.web>
    <compilation debug="true"/>
  </system.web>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="false" />
          <serviceDiscovery />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <services>
      <service name="Service.IService">
        <clear />
        <endpoint binding="basicHttpBinding" bindingConfiguration="MessageSizeBasic" contract="Service.IService" />
      </service>
    </services>
    <bindings>
      <basicHttpBinding>
        <binding name="MessageSizeBasic" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
          <readerQuotas maxDepth="32" maxStringContentLength="2147483647"
            maxArrayLength="16348" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
        </binding>
      </basicHttpBinding>
      <webHttpBinding>
        <binding name="MessageSizeWeb" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" />
      </webHttpBinding>
    </bindings>
  </system.serviceModel>
 <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>
</configuration>
4

3 に答える 3

65

バインディングから名前を削除すると、すべてのエンドポイントに名前が適用され、目的の結果が得られるはずです。そのように:

<services>
  <service name="Service.IService">
    <clear />
    <endpoint binding="basicHttpBinding" contract="Service.IService" />
  </service>
</services>
<bindings>
  <basicHttpBinding>
    <binding maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
      <readerQuotas maxDepth="32" maxStringContentLength="2147483647"
        maxArrayLength="16348" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
    </binding>
  </basicHttpBinding>
  <webHttpBinding>
    <binding maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" />
  </webHttpBinding>
</bindings>

bindingConfigurationまた、エンドポイントノードから属性 を削除したことにも注意してください。そうしないと、例外が発生します。

これと同じ解決策がここで見つかりました:WCFでの大きなリクエストの問題

于 2012-06-17T03:18:18.733 に答える
1

httpsTransportバインディングをオンにする代わりにHTTPSを使用する場合は、タグを付けてバインディングに入れます。

    <binding name="MyServiceBinding">
      <security defaultAlgorithmSuite="Basic256Rsa15" 
                authenticationMode="MutualCertificate" requireDerivedKeys="true" 
                securityHeaderLayout="Lax" includeTimestamp="true" 
                messageProtectionOrder="SignBeforeEncrypt" 
                messageSecurityVersion="WSSecurity10WSTrust13WSSecureConversation13WSSecurityPolicy12BasicSecurityProfile10"
                requireSignatureConfirmation="false">
        <localClientSettings detectReplays="true" />
        <localServiceSettings detectReplays="true" />
        <secureConversationBootstrap keyEntropyMode="CombinedEntropy" />
      </security>
      <textMessageEncoding messageVersion="Soap11WSAddressing10">
        <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" 
                      maxArrayLength="2147483647" maxBytesPerRead="4096" 
                      maxNameTableCharCount="16384"/>
      </textMessageEncoding>
      <httpsTransport maxReceivedMessageSize="2147483647" 
                      maxBufferSize="2147483647" maxBufferPoolSize="2147483647" 
                      requireClientCertificate="false" />
    </binding>
于 2015-03-17T16:06:46.193 に答える
0

サービスクラスの名前は本当にIService(Service名前空間上)ですか?おそらく元々持っていたのは、要素のname属性のサービスクラスの名前の不一致でした。<service>

于 2012-06-17T04:09:53.323 に答える