2017-06-22 1 views
0

Ich habe ein sehr ärgerliches Problem, wo mein WCF-Dienst für die meisten Anfragen feine erke, aber für eine bestimmte große Anfrage, erhalte ich diesen Fehler in meinem Header:Antrag Wesen zu groß sogar nach web.config aktualisieren

HTTP/1.1 413 anfordern Wesen zu groß

Der Antrag ist welll unter meiner angegebenen maximalen Anforderungslänge (2147483647), so ich habe keine Ahnung, warum dies geschieht.

Dies sind die Einstellungen, die ich in meine Config-Datei hinzugefügt, dies zu überwinden, aber nichts funktioniert:

<httpRuntime maxRequestLength="2147483647" /> 

<behavior> 
    <dataContractSerializer maxItemsInObjectGraph="2147483647"/> 
</behavior> 

<basicHttpBinding> 
    <binding name="secureHttpBinding" 
      maxBufferPoolSize="2147483647" 
      maxReceivedMessageSize="2147483647" 
      maxBufferSize="2147483647" 
      transferMode="Streamed"> 
     <readerQuotas 
      maxStringContentLength="2147483647" 
      maxArrayLength="2147483647" 
      maxBytesPerRead="2147483647" 
      maxDepth="64" 
      maxNameTableCharCount="2147483647"/> 
    </binding> 
</basicHttpBinding> 

Ich habe auch die gesamte Konfiguration unter Datei. Kann mir jemand helfen zu verstehen, was hier schief läuft?

Ich habe keinen Zugriff auf den Client, der diese Nachrichten in Live sendet, aber ich teste mit Soap UI.

Danke

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 
    <connectionStrings> 
    <add name="AccessConnectionString" connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Bassie\Desktop\Biz Backoffice.mdb" /> 
    <add name="LogPath" connectionString="C:\Test\pnp\pnp.log" /> 
    <add name="ErrorPath" connectionString="C:\Test\pnp\errors" /> 
    </connectionStrings> 
    <system.web> 
    <customErrors mode="Off"/> 
    <compilation debug="true" targetFramework="4.5.2" /> 
    <httpRuntime targetFramework="4.5.2" maxRequestLength="2147483647" /> 
    </system.web> 

    <system.serviceModel> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior name="debug"> 
      <serviceDebug includeExceptionDetailInFaults="true" /> 
     </behavior> 

     <behavior> 
      <dataContractSerializer maxItemsInObjectGraph="2147483647"/> 
      <!-- To avoid disclosing metadata information, set the values below to false before deployment --> 
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="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="true" /> 
     </behavior> 

     </serviceBehaviors> 

    </behaviors> 

    <services> 
     <service name="WCFService1.Service1"> 
     <endpoint address="http://Biz.ddns.net/Service1.svc" 
        binding="basicHttpBinding" 
        bindingConfiguration="secureHttpBinding" 
        contract="WCFService1.IService1" 
        /> 
     <!--<endpoint address="mex" binding="mexHttpsBinding" 
        contract="IMetadataExchange" />--> 
     </service> 
    </services> 

    <bindings> 
     <basicHttpBinding> 
     <binding name="secureHttpBinding" 
       maxBufferPoolSize="2147483647" 
       maxReceivedMessageSize="2147483647" 
       maxBufferSize="2147483647" 
       transferMode="Streamed"> 
      <readerQuotas 
       maxStringContentLength="2147483647" 
       maxArrayLength="2147483647" 
       maxBytesPerRead="2147483647" 
       maxDepth="64" 
       maxNameTableCharCount="2147483647"/> 

      <security mode="Transport"> 
       <transport clientCredentialType="Basic" /> 
      </security> 
     </binding> 
     </basicHttpBinding> 
    </bindings> 

    <protocolMapping> 
     <add binding="basicHttpsBinding" scheme="https" /> 
    </protocolMapping>  
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /> 

    </system.serviceModel> 

    <system.webServer> 
    <modules runAllManagedModulesForAllRequests="true" /> 
    <!-- 
     To browse web app root directory during debugging, set the value below to true. 
     Set to false before deployment to avoid disclosing web app folder information. 
     --> 
    <directoryBrowse enabled="true" /> 
    </system.webServer> 

    <runtime> 
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> 
     <dependentAssembly> 
     <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" /> 
     <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" /> 
     </dependentAssembly> 
    </assemblyBinding> 
    </runtime> 

</configuration> 

Hier ist ein Beispiel-Nachricht (in Soap Umschlag verpackt, wenn natürlich gesendet werden) ist. Sie werden feststellen, dass es nur 2 receivingAdviceItemContainmentLineItem Elemente, aber die Botschaft, die mir die problemn enthält etwa 50 Beachten Sie, dass die vollständige Meldung zu geben, die nicht funktioniert, um 128kb groß ist, wenn in einer Datei gespeichert:

<sh:StandardBusinessDocument 
    xmlns:sh="http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader" 
    xmlns:deliver="urn:ean.ucc:deliver:2" 
    xmlns:eanucc="urn:ean.ucc:2" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
    <sh:StandardBusinessDocumentHeader> 
     <sh:HeaderVersion>1.0</sh:HeaderVersion> 
     <sh:Sender> 
      <sh:Identifier Authority="EAN.UCC">6001000000001</sh:Identifier> 
     </sh:Sender> 
     <sh:Receiver> 
      <sh:Identifier Authority="EAN.UCC">6001007805159</sh:Identifier> 
     </sh:Receiver> 
     <sh:DocumentIdentification> 
      <sh:Standard>EAN.UCC</sh:Standard> 
      <sh:TypeVersion>2.5</sh:TypeVersion> 
      <sh:InstanceIdentifier>0000000643343333</sh:InstanceIdentifier> 
      <sh:Type>ReceivingAdvice</sh:Type> 
      <sh:MultipleType>false</sh:MultipleType> 
      <sh:CreationDateAndTime>2017-06-22T00:00:00</sh:CreationDateAndTime> 
     </sh:DocumentIdentification> 
    </sh:StandardBusinessDocumentHeader> 
    <eanucc:message> 
     <entityIdentification> 
      <uniqueCreatorIdentification>G_REC_5005721318</uniqueCreatorIdentification> 
      <contentOwner> 
       <gln>6001000000001</gln> 
      </contentOwner> 
     </entityIdentification> 
     <eanucc:transaction> 
      <entityIdentification> 
       <uniqueCreatorIdentification>G_REC_5005721318</uniqueCreatorIdentification> 
       <contentOwner> 
        <gln>6001000000001</gln> 
       </contentOwner> 
      </entityIdentification> 
      <command> 
       <eanucc:documentCommand> 
        <documentCommandHeader type="ADD"> 
         <entityIdentification> 
          <uniqueCreatorIdentification /> 
          <contentOwner> 
           <gln>6001000000001</gln> 
          </contentOwner> 
         </entityIdentification> 
        </documentCommandHeader> 
        <documentCommandOperand> 
         <deliver:receivingAdvice creationDateTime="2017-06-22T00:00:00" documentStatus="ORIGINAL"> 
          <documentStructureVersion> 
           <versionIdentification>2.5</versionIdentification> 
          </documentStructureVersion> 
          <reportingCode>CONFIRMATION</reportingCode> 
          <receivingAdviceIdentification> 
           <uniqueCreatorIdentification>G_REC_5005721318</uniqueCreatorIdentification> 
           <contentOwner> 
            <gln>6001000000001</gln> 
           </contentOwner> 
          </receivingAdviceIdentification> 
          <shipTo> 
           <gln>6001007022334</gln> 
           <additionalPartyIdentification> 
            <additionalPartyIdentificationValue>MA08</additionalPartyIdentificationValue> 
            <additionalPartyIdentificationType>BUYER_ASSIGNED_IDENTIFIER_FOR_A_PARTY</additionalPartyIdentificationType> 
           </additionalPartyIdentification> 
          </shipTo> 
          <shipper> 
           <gln>6001007805159</gln> 
          </shipper> 
          <receiver> 
           <gln>6001007022334</gln> 
          </receiver> 
          <receivingAdviceItemContainmentLineItem number="0001"> 
           <containedItemIdentification> 
            <gtin>16001000806532</gtin> 
            <additionalTradeItemIdentification> 
             <additionalTradeItemIdentificationValue>109395</additionalTradeItemIdentificationValue> 
             <additionalTradeItemIdentificationType>SUPPLIER_ASSIGNED</additionalTradeItemIdentificationType> 
            </additionalTradeItemIdentification> 
            <additionalTradeItemIdentification> 
             <additionalTradeItemIdentificationValue>client GEM SQUASH LS 1PK</additionalTradeItemIdentificationValue> 
             <additionalTradeItemIdentificationType>BUYER_ASSIGNED</additionalTradeItemIdentificationType> 
            </additionalTradeItemIdentification> 
            <additionalTradeItemIdentification> 
             <additionalTradeItemIdentificationValue>000000000000109395</additionalTradeItemIdentificationValue> 
             <additionalTradeItemIdentificationType>BUYER_ASSIGNED</additionalTradeItemIdentificationType> 
            </additionalTradeItemIdentification> 
           </containedItemIdentification> 
           <specification number="0"> 
            <reference> 
             <referenceDateTime>0000-00-00T00:00:00.000</referenceDateTime> 
             <referenceIdentification>NFI72449</referenceIdentification> 
            </reference> 
           </specification> 
           <purchaseOrder> 
            <documentReference creationDateTime="0000-00-00T00:00:00.000"> 
             <uniqueCreatorIdentification>4529222808</uniqueCreatorIdentification> 
             <contentOwner> 
              <gln>6001000000001</gln> 
             </contentOwner> 
            </documentReference> 
           </purchaseOrder> 
           <quantityAccepted> 
            <value>9.000</value> 
            <unitOfMeasure> 
             <measurementUnitCodeValue>CK2</measurementUnitCodeValue> 
            </unitOfMeasure> 
           </quantityAccepted> 
           <quantityReceived> 
            <value>9.000</value> 
            <unitOfMeasure> 
             <measurementUnitCodeValue>CK2</measurementUnitCodeValue> 
            </unitOfMeasure> 
           </quantityReceived> 
           <receivingConditionInformation> 
            <receivingCondition>GOOD_CONDITION</receivingCondition> 
            <receivingConditionQuantity> 
             <value>9</value> 
            </receivingConditionQuantity> 
           </receivingConditionInformation> 
          </receivingAdviceItemContainmentLineItem> 
          <receivingAdviceItemContainmentLineItem number="0002"> 
           <containedItemIdentification> 
            <gtin>96001007182697</gtin> 
            <additionalTradeItemIdentification> 
             <additionalTradeItemIdentificationValue>392007</additionalTradeItemIdentificationValue> 
             <additionalTradeItemIdentificationType>SUPPLIER_ASSIGNED</additionalTradeItemIdentificationType> 
            </additionalTradeItemIdentification> 
            <additionalTradeItemIdentification> 
             <additionalTradeItemIdentificationValue>thirdparty PLASTIC CRATE</additionalTradeItemIdentificationValue> 
             <additionalTradeItemIdentificationType>BUYER_ASSIGNED</additionalTradeItemIdentificationType> 
            </additionalTradeItemIdentification> 
            <additionalTradeItemIdentification> 
             <additionalTradeItemIdentificationValue>000000000000392007</additionalTradeItemIdentificationValue> 
             <additionalTradeItemIdentificationType>BUYER_ASSIGNED</additionalTradeItemIdentificationType> 
            </additionalTradeItemIdentification> 
           </containedItemIdentification> 
           <specification number="0"> 
            <reference> 
             <referenceDateTime>0000-00-00T00:00:00.000</referenceDateTime> 
             <referenceIdentification>NFI72449</referenceIdentification> 
            </reference> 
           </specification> 
           <purchaseOrder> 
            <documentReference creationDateTime="0000-00-00T00:00:00.000"> 
             <uniqueCreatorIdentification>4529222808</uniqueCreatorIdentification> 
             <contentOwner> 
              <gln>6001000000001</gln> 
             </contentOwner> 
            </documentReference> 
           </purchaseOrder> 
           <quantityAccepted> 
            <value>9.000</value> 
            <unitOfMeasure> 
             <measurementUnitCodeValue>EA</measurementUnitCodeValue> 
            </unitOfMeasure> 
           </quantityAccepted> 
           <quantityReceived> 
            <value>9.000</value> 
            <unitOfMeasure> 
             <measurementUnitCodeValue>EA</measurementUnitCodeValue> 
            </unitOfMeasure> 
           </quantityReceived> 
           <receivingConditionInformation> 
            <receivingCondition>GOOD_CONDITION</receivingCondition> 
            <receivingConditionQuantity> 
             <value>9</value> 
            </receivingConditionQuantity> 
           </receivingConditionInformation> 
          </receivingAdviceItemContainmentLineItem> 
          <receiptInformation> 
           <receivingDateTime>2017-06-22T00:00:00</receivingDateTime> 
          </receiptInformation> 
          <consignmentIdentification> 
           <referenceDateTime>2017-06-22T00:00:00</referenceDateTime> 
           <referenceIdentification>NFI72449</referenceIdentification> 
          </consignmentIdentification> 
         </deliver:receivingAdvice> 
        </documentCommandOperand> 
       </eanucc:documentCommand> 
      </command> 
     </eanucc:transaction> 
    </eanucc:message> 
</sh:StandardBusinessDocument> 
+0

https://Stackoverflow.com/a/8061762/34092 kann eine Lektüre wert sein. – mjwills

+0

Können Sie uns die zu sendende Payload zeigen, die fehlschlägt? – mjwills

+0

@mjwills Ich versuchte, es aufzunehmen, aber es sagt der Körper ist zu groß ... Ich werde ein Beispiel setzen und versuchen, – Bassie

Antwort

0

ich änderte meine web.config, so dass es wie folgt aussieht:

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 
    <connectionStrings> 
    <add name="AccessConnectionString" connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Bassie\Desktop\AllwaysFresh Backoffice.mdb" /> 
    <add name="LogPath" connectionString="C:\Test\pnp\pnp.log" /> 
    <add name="ErrorPath" connectionString="C:\Test\pnp\errors" /> 
    </connectionStrings> 
    <system.web> 
    <customErrors mode="Off"/> 
    <compilation debug="true" targetFramework="4.5.2" /> 
    <httpRuntime targetFramework="4.5.2" maxRequestLength="2097151" /> 
    </system.web> 

    <system.serviceModel> 

    <behaviors> 
     <serviceBehaviors> 
     <behavior name="debug"> 
      <serviceDebug includeExceptionDetailInFaults="true" /> 
     </behavior> 

     <behavior> 
      <dataContractSerializer maxItemsInObjectGraph="2097151"/> 
      <!-- To avoid disclosing metadata information, set the values below to false before deployment --> 
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="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="true" /> 
     </behavior> 

     </serviceBehaviors> 

    </behaviors> 

    <services> 
     <service name="Service1"> 
     <endpoint address="" 
        binding="basicHttpBinding" 
        contract="IService1" 
        /> 
     </service> 
    </services> 

    <bindings> 
     <basicHttpBinding> 
     <binding maxBufferPoolSize="2097151" 
       maxReceivedMessageSize="2097151" 
       maxBufferSize="2097151" 
       transferMode="Streamed"> 
      <readerQuotas 
       maxStringContentLength="2097151" 
       maxArrayLength="2097151" 
       maxBytesPerRead="2097151" 
       maxDepth="2097151" 
       maxNameTableCharCount="2097151"/> 
     </binding> 
     </basicHttpBinding> 

    </bindings> 

    </system.serviceModel> 

    <system.webServer> 
    <security> 
     <requestFiltering> 
     <requestLimits maxAllowedContentLength="2147483648" /> 
     </requestFiltering> 
    </security> 

    <modules runAllManagedModulesForAllRequests="true" /> 
    <!-- 
     To browse web app root directory during debugging, set the value below to true. 
     Set to false before deployment to avoid disclosing web app folder information. 
     --> 
    <directoryBrowse enabled="true" /> 
    </system.webServer> 

    <runtime> 
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> 
     <dependentAssembly> 
     <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" /> 
     <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" /> 
     </dependentAssembly> 
    </assemblyBinding> 
    </runtime> 

</configuration> 

Und es scheint, jetzt zu arbeiten ...

ich verschiedene Bits der Konfigurationsdatei, von denen keines scheint besonders relevant, so geändert, dass nicht sicher warum Es klappt. Wenn jemand etwas Licht darauf werfen könnte, wäre das großartig.

Verwandte Themen