0

やあ、

クライアント アプリケーションからカスタム データを WCF Web サイトに送信しようとしています。おそらく大量のデータを送信しようとすると機能しません。

失敗する命令は次のとおりです。

roleCliente.SaveStructure(role, ref s);

「ロール」には、カスタム オブジェクトのリストが含まれています。リストが十分に短い場合、命令は正しく機能します。

サーバー側の web.config は次のとおりです。

<configuration>

  <system.web>
    <compilation debug="true" targetFramework="4.0"/>
    <httpRuntime maxQueryStringLength="2097151"/>
  </system.web>

  <system.diagnostics>
        <sources>
           <source name="System.ServiceModel" switchValue="All">
             <listeners>
                  <add name="xmlTraceListener" />
               </listeners>
           </source>
           <source name="System.ServiceModel.MessageLogging" switchValue="All">
               <listeners>
                   <add name="xmlTraceListener" />
               </listeners>
           </source>
       </sources>
       <sharedListeners>
        <add name="xmlTraceListener" type="System.Diagnostics.XmlWriterTraceListener" initializeData="ClientLogBasic.svclog" />
     </sharedListeners>
     <trace autoflush="true" />
 </system.diagnostics>


  <system.serviceModel>

    <diagnostics>
      <messageLogging maxMessagesToLog="10000" logEntireMessage="true" logMessagesAtServiceLevel="true" logMalformedMessages="true" logMessagesAtTransportLevel="true">
        <filters>
          <clear/>
        </filters>
      </messageLogging>
    </diagnostics>

    <behaviors>
      <endpointBehaviors>
        <behavior name="EndPointBehavior">
          <dataContractSerializer maxItemsInObjectGraph="2147483647" />
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>
        <behavior name="ServiceBehaviour">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
          <dataContractSerializer maxItemsInObjectGraph="2147483647" />
        </behavior>
      </serviceBehaviors>
    </behaviors>

    <bindings>
      <basicHttpBinding>
        <binding name="CustomBinding" closeTimeout="00:10:00" openTimeout="00:10:00"
          sendTimeout="00:10:00" maxBufferSize="2147483647" maxBufferPoolSize="2147483647"
          maxReceivedMessageSize="2147483647">
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
            maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
        </binding>
      </basicHttpBinding>
    </bindings>

    <services>
      <service behaviorConfiguration="ServiceBehaviour" name="ServiceReference1.WCFAgency">
        <endpoint address="http://193.205.191.6/WCFSiretCM/WCFSiretCM.svc"
          behaviorConfiguration="EndPointBehavior" binding="basicHttpBinding"
          bindingConfiguration="CustomBinding" name="WCFAgency" contract="ServiceReference1.IWCFAgency" />
      </service>
      <service behaviorConfiguration="ServiceBehaviour" name="ServiceReference1.WCFCompetence">
        <endpoint address="http://193.205.191.6/WCFSiretCM/WCFSiretCM.svc"
          behaviorConfiguration="EndPointBehavior" binding="basicHttpBinding"
          bindingConfiguration="CustomBinding" name="WCFCompetence" contract="ServiceReference1.IWCFCompetence" />
      </service>
      <service behaviorConfiguration="ServiceBehaviour" name="ServiceReference1.WCFCompetenceScheme">
        <endpoint address="http://193.205.191.6/WCFSiretCM/WCFSiretCM.svc"
          behaviorConfiguration="EndPointBehavior" binding="basicHttpBinding"
          bindingConfiguration="CustomBinding" name="WCFCompetenceScheme"
          contract="ServiceReference1.IWCFCompetenceScheme" />
      </service>
      <service behaviorConfiguration="ServiceBehaviour" name="ServiceReference1.WCFPerson">
        <endpoint address="http://193.205.191.6/WCFSiretCM/WCFSiretCM.svc"
          behaviorConfiguration="EndPointBehavior" binding="basicHttpBinding"
          bindingConfiguration="CustomBinding" name="WCFPerson" contract="ServiceReference1.IWCFCompetenceScheme" />
      </service>
      <service behaviorConfiguration="ServiceBehaviour" name="ServiceReference1.WCFCertificate">
        <endpoint address="http://193.205.191.6/WCFSiretCM/WCFSiretCM.svc"
          behaviorConfiguration="EndPointBehavior" binding="basicHttpBinding"
          bindingConfiguration="CustomBinding" name="WCFCertificate" contract="ServiceReference1.IWCFCertificate" />
      </service>
      <service behaviorConfiguration="ServiceBehaviour" name="ServiceReference1.WCFAttitude">
        <endpoint address="http://193.205.191.6/WCFSiretCM/WCFSiretCM.svc"
          behaviorConfiguration="EndPointBehavior" binding="basicHttpBinding"
          bindingConfiguration="CustomBinding" name="WCFAttitude" contract="ServiceReference1.IWCFAttitude" />
      </service>
      <service behaviorConfiguration="ServiceBehaviour" name="ServiceReference1.WCFClassificationType">
        <endpoint address="http://193.205.191.6/WCFSiretCM/WCFSiretCM.svc"
          behaviorConfiguration="EndPointBehavior" binding="basicHttpBinding"
          bindingConfiguration="CustomBinding" name="WCFClassificationType"
          contract="ServiceReference1.IWCFClassificationType" />
      </service>
      <service behaviorConfiguration="ServiceBehaviour" name="ServiceReference1.WCFCompetenceDetail">
        <endpoint address="http://193.205.191.6/WCFSiretCM/WCFSiretCM.svc"
          behaviorConfiguration="EndPointBehavior" binding="basicHttpBinding"
          bindingConfiguration="CustomBinding" name="WCFCompetenceDetail"
          contract="ServiceReference1.IWCFCompetenceDetail" />
      </service>
      <service behaviorConfiguration="ServiceBehaviour" name="ServiceReference1.WCFCompetencyDetail">
        <endpoint address="http://193.205.191.6/WCFSiretCM/WCFSiretCM.svc"
          behaviorConfiguration="EndPointBehavior" binding="basicHttpBinding"
          bindingConfiguration="CustomBinding" name="WCFCompetencyDetail"
          contract="ServiceReference1.IWCFCompetencyDetail" />
      </service>
      <service behaviorConfiguration="ServiceBehaviour" name="ServiceReference1.WCFCompetencyScheme">
        <endpoint address="http://193.205.191.6/WCFSiretCM/WCFSiretCM.svc"
          behaviorConfiguration="EndPointBehavior" binding="basicHttpBinding"
          bindingConfiguration="CustomBinding" name="WCFCompetencyScheme"
          contract="ServiceReference1.IWCFCompetencyScheme" />
      </service>
      <service behaviorConfiguration="ServiceBehaviour" name="ServiceReference1.WCFContext">
        <endpoint address="http://193.205.191.6/WCFSiretCM/WCFSiretCM.svc"
          behaviorConfiguration="EndPointBehavior" binding="basicHttpBinding"
          bindingConfiguration="CustomBinding" name="WCFContext" contract="ServiceReference1.IWCFContext" />
      </service>
      <service behaviorConfiguration="ServiceBehaviour" name="ServiceReference1.WCFEducation">
        <endpoint address="http://193.205.191.6/WCFSiretCM/WCFSiretCM.svc"
          behaviorConfiguration="EndPointBehavior" binding="basicHttpBinding"
          bindingConfiguration="CustomBinding" name="WCFEducation" contract="ServiceReference1.IWCFEducation" />
      </service>
      <service behaviorConfiguration="ServiceBehaviour" name="ServiceReference1.WCFEvidence">
        <endpoint address="http://193.205.191.6/WCFSiretCM/WCFSiretCM.svc"
          behaviorConfiguration="EndPointBehavior" binding="basicHttpBinding"
          bindingConfiguration="CustomBinding" name="WCFEvidence" contract="ServiceReference1.IWCFEvidence" />
      </service>
      <service behaviorConfiguration="ServiceBehaviour" name="ServiceReference1.WCFFormativeCredit">
        <endpoint address="http://193.205.191.6/WCFSiretCM/WCFSiretCM.svc"
          behaviorConfiguration="EndPointBehavior" binding="basicHttpBinding"
          bindingConfiguration="CustomBinding" name="WCFFormativeCredit"
          contract="ServiceReference1.IWCFFormativeCredit" />
      </service>
      <service behaviorConfiguration="ServiceBehaviour" name="ServiceReference1.WCFInstructionalEntity">
        <endpoint address="http://193.205.191.6/WCFSiretCM/WCFSiretCM.svc"
          behaviorConfiguration="EndPointBehavior" binding="basicHttpBinding"
          bindingConfiguration="CustomBinding" name="WCFInstructionalEntity"
          contract="ServiceReference1.IWCFInstructionalEntity" />
      </service>
      <service behaviorConfiguration="ServiceBehaviour" name="ServiceReference1.WCFKnowledge">
        <endpoint address="http://193.205.191.6/WCFSiretCM/WCFSiretCM.svc"
          behaviorConfiguration="EndPointBehavior" binding="basicHttpBinding"
          bindingConfiguration="CustomBinding" name="WCFKnowledge" contract="ServiceReference1.IWCFKnowledge" />
      </service>
      <service behaviorConfiguration="ServiceBehaviour" name="ServiceReference1.WCFResponsibility">
        <endpoint address="http://193.205.191.6/WCFSiretCM/WCFSiretCM.svc"
          behaviorConfiguration="EndPointBehavior" binding="basicHttpBinding"
          bindingConfiguration="CustomBinding" name="WCFResponsibility"
          contract="ServiceReference1.IWCFResponsibility" />
      </service>
      <service behaviorConfiguration="ServiceBehaviour" name="ServiceReference1.WCFRole">
        <endpoint address="http://193.205.191.6/WCFSiretCM/WCFSiretCM.svc"
          behaviorConfiguration="EndPointBehavior" binding="basicHttpBinding"
          bindingConfiguration="CustomBinding" name="WCFRole" contract="ServiceReference1.IWCFRole" />
      </service>
      <service behaviorConfiguration="ServiceBehaviour" name="ServiceReference1.WCFRoleScheme">
        <endpoint address="http://193.205.191.6/WCFSiretCM/WCFSiretCM.svc"
          behaviorConfiguration="EndPointBehavior" binding="basicHttpBinding"
          bindingConfiguration="CustomBinding" name="WCFRoleScheme" contract="ServiceReference1.IWCFRoleScheme" />
      </service>
      <service behaviorConfiguration="ServiceBehaviour" name="ServiceReference1.WCFScale">
        <endpoint address="http://193.205.191.6/WCFSiretCM/WCFSiretCM.svc"
          binding="basicHttpBinding" name="WCFScale" contract="ServiceReference1.IWCFScale" />
      </service>
      <service behaviorConfiguration="ServiceBehaviour" name="ServiceReference1.WCFSkill">
        <endpoint address="http://193.205.191.6/WCFSiretCM/WCFSiretCM.svc"
          binding="basicHttpBinding" name="WCFSkill" contract="ServiceReference1.IWCFSkill" />
      </service>
    </services>

  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>  
</configuration>

クライアント側の web.config は次のとおりです。

<configuration>
  <connectionStrings>
    <add name="ApplicationServices"
         connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true"
         providerName="System.Data.SqlClient" />
  </connectionStrings>
  <system.web>
    <httpRuntime maxQueryStringLength="2097151"/>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
  <system.webServer>
     <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>
  <system.serviceModel>
    <behaviors>
      <endpointBehaviors>
        <behavior name="EndPointBehavior">
          <dataContractSerializer maxItemsInObjectGraph="2147483647" />
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>
        <behavior name="ServiceBehaviour">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
          <dataContractSerializer maxItemsInObjectGraph="2147483647" />
        </behavior>
      </serviceBehaviors>
    </behaviors>

    <bindings>
      <basicHttpBinding>
        <binding name="CustomBinding" closeTimeout="00:10:00"
          openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
          allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
          maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
          messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
          useDefaultWebProxy="true">
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
            maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None"
              realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>        
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost/WCFSiretCM/WCFSiretCM.svc" behaviorConfiguration="EndPointBehavior"
        binding="basicHttpBinding" bindingConfiguration="CustomBinding"
        contract="ServiceReference1.IWCFAgency" name="BasicHttpBinding_IWCFAgency" />
      <endpoint address="http://localhost/WCFSiretCM/WCFSiretCM.svc" behaviorConfiguration="EndPointBehavior"
        binding="basicHttpBinding" bindingConfiguration="CustomBinding"
        contract="ServiceReference1.IWCFPerson" name="BasicHttpBinding_IWCFPerson" />
      <endpoint address="http://localhost/WCFSiretCM/WCFSiretCM.svc" behaviorConfiguration="EndPointBehavior"
        binding="basicHttpBinding" bindingConfiguration="CustomBinding"
        contract="ServiceReference1.IWCFCertificate" name="BasicHttpBinding_IWCFCertificate" />
      <endpoint address="http://localhost/WCFSiretCM/WCFSiretCM.svc" behaviorConfiguration="EndPointBehavior"
        binding="basicHttpBinding" bindingConfiguration="CustomBinding"
        contract="ServiceReference1.IWCFAttitude" name="BasicHttpBinding_IWCFAttitude" />
      <endpoint address="http://localhost/WCFSiretCM/WCFSiretCM.svc" behaviorConfiguration="EndPointBehavior"
        binding="basicHttpBinding" bindingConfiguration="CustomBinding"
        contract="ServiceReference1.IWCFClassificationType" name="BasicHttpBinding_IWCFClassificationType" />
      <endpoint address="http://localhost/WCFSiretCM/WCFSiretCM.svc" behaviorConfiguration="EndPointBehavior"
        binding="basicHttpBinding" bindingConfiguration="CustomBinding"
        contract="ServiceReference1.IWCFCompetence" name="BasicHttpBinding_IWCFCompetence" />
      <endpoint address="http://localhost/WCFSiretCM/WCFSiretCM.svc" behaviorConfiguration="EndPointBehavior"
        binding="basicHttpBinding" bindingConfiguration="CustomBinding"
        contract="ServiceReference1.IWCFCompetenceDetail" name="BasicHttpBinding_IWCFCompetenceDetail" />
      <endpoint address="http://localhost/WCFSiretCM/WCFSiretCM.svc" behaviorConfiguration="EndPointBehavior"
        binding="basicHttpBinding" bindingConfiguration="CustomBinding"
        contract="ServiceReference1.IWCFCompetenceScheme" name="BasicHttpBinding_IWCFCompetenceScheme" />
      <endpoint address="http://localhost/WCFSiretCM/WCFSiretCM.svc" behaviorConfiguration="EndPointBehavior"
        binding="basicHttpBinding" bindingConfiguration="CustomBinding"
        contract="ServiceReference1.IWCFCompetencyDetail" name="BasicHttpBinding_IWCFCompetencyDetail" />
      <endpoint address="http://localhost/WCFSiretCM/WCFSiretCM.svc" behaviorConfiguration="EndPointBehavior"
        binding="basicHttpBinding" bindingConfiguration="CustomBinding" 
        contract="ServiceReference1.IWCFCompetencyScheme" name="BasicHttpBinding_IWCFCompetencyScheme" />
      <endpoint address="http://localhost/WCFSiretCM/WCFSiretCM.svc" behaviorConfiguration="EndPointBehavior"
        binding="basicHttpBinding" bindingConfiguration="CustomBinding"
        contract="ServiceReference1.IWCFContext" name="BasicHttpBinding_IWCFContext" />
      <endpoint address="http://localhost/WCFSiretCM/WCFSiretCM.svc" behaviorConfiguration="EndPointBehavior"
        binding="basicHttpBinding" bindingConfiguration="CustomBinding"
        contract="ServiceReference1.IWCFEducation" name="BasicHttpBinding_IWCFEducation" />
      <endpoint address="http://localhost/WCFSiretCM/WCFSiretCM.svc" behaviorConfiguration="EndPointBehavior"
        binding="basicHttpBinding" bindingConfiguration="CustomBinding"
        contract="ServiceReference1.IWCFEvidence" name="BasicHttpBinding_IWCFEvidence" />
      <endpoint address="http://localhost/WCFSiretCM/WCFSiretCM.svc" behaviorConfiguration="EndPointBehavior"
        binding="basicHttpBinding" bindingConfiguration="CustomBinding"
        contract="ServiceReference1.IWCFFormativeCredit" name="BasicHttpBinding_IWCFFormativeCredit" />
      <endpoint address="http://localhost/WCFSiretCM/WCFSiretCM.svc" behaviorConfiguration="EndPointBehavior"
        binding="basicHttpBinding" bindingConfiguration="CustomBinding"
        contract="ServiceReference1.IWCFInstructionalEntity" name="BasicHttpBinding_IWCFInstructionalEntity" />
      <endpoint address="http://localhost/WCFSiretCM/WCFSiretCM.svc" behaviorConfiguration="EndPointBehavior"
        binding="basicHttpBinding" bindingConfiguration="CustomBinding"
        contract="ServiceReference1.IWCFKnowledge" name="BasicHttpBinding_IWCFKnowledge" />
      <endpoint address="http://localhost/WCFSiretCM/WCFSiretCM.svc" behaviorConfiguration="EndPointBehavior"
        binding="basicHttpBinding" bindingConfiguration="CustomBinding"
        contract="ServiceReference1.IWCFResponsibility" name="BasicHttpBinding_IWCFResponsibility" />
      <endpoint address="http://localhost/WCFSiretCM/WCFSiretCM.svc"
        behaviorConfiguration="EndPointBehavior" binding="basicHttpBinding"
        bindingConfiguration="CustomBinding" contract="ServiceReference1.IWCFRole"
        name="BasicHttpBinding_IWCFRole" />
      <endpoint address="http://localhost/WCFSiretCM/WCFSiretCM.svc" 
        behaviorConfiguration="EndPointBehavior" binding="basicHttpBinding"
        bindingConfiguration="CustomBinding" contract="ServiceReference1.IWCFRoleScheme"
        name="BasicHttpBinding_IWCFRoleScheme" />
      <endpoint address="http://localhost/WCFSiretCM/WCFSiretCM.svc" behaviorConfiguration="EndPointBehavior"
        binding="basicHttpBinding" bindingConfiguration="CustomBinding"
        contract="ServiceReference1.IWCFScale" name="BasicHttpBinding_IWCFScale" />
      <endpoint address="http://localhost/WCFSiretCM/WCFSiretCM.svc" behaviorConfiguration="EndPointBehavior"
        binding="basicHttpBinding" bindingConfiguration="CustomBinding"
        contract="ServiceReference1.IWCFSkill" name="BasicHttpBinding_IWCFSkill" />
    </client>
  </system.serviceModel>
</configuration>
4

2 に答える 2

0

WCF で大量のデータを送信する場合は、おそらくストリーミング モードを使用できます。

http://msdn.microsoft.com/en-us/library/ms731913.aspx

http://msdn.microsoft.com/en-us/library/ms733742.aspx

または、回避策を使用して、次のようなサービスでいくつかのメソッドを実装することにより、データをチャンクで転送することもできます

StartUpload()

SendChunk(byte[] chunk)

EndUpload()
于 2012-10-05T15:05:13.950 に答える
0

単純に最大クォータまたはタイムアウトを増やすと思われるようにメッセージをチャンクすることにした場合、実際には 2 つのオプションがあります。

オプション 1:自分でチャンクする

オプション 2:チャネル チャンク http://msdn.microsoft.com/en-us/library/aa717050(v=vs.110).aspx

于 2013-12-20T16:51:50.737 に答える